Add g_delete_profile to group properties, default = 0. Configured in the admin panel in groups.

Will not work until the update to revision 63 is completed.
This commit is contained in:
Visman 2023-07-19 18:30:30 +07:00
parent c21fdc7423
commit f66c890db3
6 changed files with 27 additions and 2 deletions

View file

@ -287,6 +287,7 @@ class Groups extends Admin
'g_edit_posts' => 'required|integer|in:0,1',
'g_delete_posts' => 'required|integer|in:0,1',
'g_delete_topics' => 'required|integer|in:0,1',
'g_delete_profile' => 'required|integer|in:0,1',
'g_deledit_interval' => 'required|integer|min:0|max:999999',
'g_set_title' => 'required|integer|in:0,1',
'g_send_email' => 'required|integer|in:0,1',
@ -600,6 +601,13 @@ class Groups extends Admin
'caption' => 'Delete topics label',
'help' => 'Delete topics help',
];
$fieldset['g_delete_profile'] = [
'type' => 'radio',
'value' => $group->g_delete_profile,
'values' => $yn,
'caption' => 'Delete profile label',
'help' => 'Delete profile help',
];
$fieldset['g_set_title'] = [
'type' => 'radio',
'value' => $group->g_set_title,

View file

@ -866,6 +866,7 @@ class Install extends Admin
'g_edit_posts' => ['TINYINT(1)', false, 1],
'g_delete_posts' => ['TINYINT(1)', false, 1],
'g_delete_topics' => ['TINYINT(1)', false, 1],
'g_delete_profile' => ['TINYINT(1)', false, 0],
'g_post_links' => ['TINYINT(1)', false, 1],
'g_set_title' => ['TINYINT(1)', false, 1],
'g_search' => ['TINYINT(1)', false, 1],

View file

@ -25,7 +25,7 @@ class Update extends Admin
{
const PHP_MIN = '8.0.0';
const REV_MIN_FOR_UPDATE = 53;
const LATEST_REV_WITH_DB_CHANGES = 62;
const LATEST_REV_WITH_DB_CHANGES = 63;
const LOCK_NAME = 'lock_update';
const LOCK_TTL = 1800;
const CONFIG_FILE = 'main.php';
@ -778,6 +778,8 @@ class Update extends Admin
$coreConfig->save();
$this->c->DB->addField('::groups', 'g_delete_profile', 'TINYINT(1)', false, 0);
return null;
}
}

View file

@ -136,7 +136,9 @@ class Profile extends Rules
protected function getdeleteMyProfile(): bool
{
return $this->my && ! $this->user->isAdmin;
return $this->my
&& ! $this->user->isAdmin
&& 1 === $this->curUser->g_delete_profile;
}
protected function getviewIP(): bool

View file

@ -317,3 +317,9 @@ msgstr "Disk space limit"
msgid "Disk space limit help"
msgstr "Disk space limit (<b>MiB</b>). Set to 0 to disable file uploads for this group."
msgid "Delete profile label"
msgstr "Delete profile"
msgid "Delete profile help"
msgstr "Allow users of this group to delete their profile (<b>user&apos;s messages will not be deleted</b>)."

View file

@ -317,3 +317,9 @@ msgstr "Лимит диска"
msgid "Disk space limit help"
msgstr "Лимит дискового пространства (<b>МиБайт</b>). Поставьте 0, чтобы запретить загрузку файлов для этой группы."
msgid "Delete profile label"
msgstr "Удалять профиль"
msgid "Delete profile help"
msgstr "Разрешить пользователям этой группы удалять свой профиль (<b>сообщения пользователя удалены не будут</b>)."