Do not allow changing of some options by unauthorized users or bots.

GitOrigin-RevId: 0a86c99779a8df3e300ae798c0e0f46b1c7fe813
This commit is contained in:
levlam 2018-09-15 15:52:03 +03:00
parent 559b20840a
commit b480409927

View File

@ -6207,10 +6207,10 @@ void Td::on_request(uint64 id, td_api::setOption &request) {
switch (request.name_[0]) { switch (request.name_[0]) {
case 'd': case 'd':
if (set_boolean_option("disable_contact_registered_notifications")) { if (!auth_manager_->is_bot() && set_boolean_option("disable_contact_registered_notifications")) {
return; return;
} }
if (set_boolean_option("disable_top_chats")) { if (auth_manager_->is_authorized() && !auth_manager_->is_bot() && set_boolean_option("disable_top_chats")) {
return; return;
} }
break; break;
@ -6223,13 +6223,16 @@ void Td::on_request(uint64 id, td_api::setOption &request) {
} }
break; break;
case 'l': case 'l':
if (set_string_option("language_pack_database_path", [](Slice value) { return true; })) { if (!auth_manager_->is_bot() &&
set_string_option("language_pack_database_path", [](Slice value) { return true; })) {
return; return;
} }
if (set_string_option("localization_target", LanguagePackManager::check_language_pack_name)) { if (!auth_manager_->is_bot() &&
set_string_option("localization_target", LanguagePackManager::check_language_pack_name)) {
return; return;
} }
if (set_string_option("language_pack_id", LanguagePackManager::check_language_code_name)) { if (!auth_manager_->is_bot() &&
set_string_option("language_pack_id", LanguagePackManager::check_language_code_name)) {
return; return;
} }
break; break;