Skip to content

Commit

Permalink
User - Show the roles in creation/edition user (only for admins) from…
Browse files Browse the repository at this point in the history
… configuration - refs BT#19630
  • Loading branch information
cfasanando committed Jan 26, 2022
1 parent 1443c2f commit 33e4fbb
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
12 changes: 11 additions & 1 deletion main/inc/lib/usermanager.lib.php
Expand Up @@ -7263,9 +7263,19 @@ public static function redirectToResetPassword($userId)
*/
public static function getUserStatusList()
{
$status = [];
$userStatusConfig = [];
// it gets the roles to show in creation/edition user
if (true === api_get_configuration_value('hide_user_status_options_enabled')) {
$userStatusConfig = api_get_configuration_value('user_status_hide_option');

}
// it gets the roles to show in creation/edition user (only for admins)
if (true === api_get_configuration_value('user_status_option_only_for_admin_enabled') && api_is_platform_admin()) {
$userStatusConfig = api_get_configuration_value('user_status_option_show_only_for_admin');
}

$status = [];
if (!empty($userStatusConfig)) {
$statusLang = api_get_status_langvars();
foreach ($userStatusConfig as $role => $enabled) {
if ($enabled) {
Expand Down
13 changes: 13 additions & 0 deletions main/install/configuration.dist.php
Expand Up @@ -2096,6 +2096,19 @@
'INVITEE' => false
];*/

// Enables to hide user status when option is true visible only for admins from $_configuration['user_status_option_show_only_for_admin']
//$_configuration['user_status_option_only_for_admin_enabled'] = false;
// The user status is hidden when is false, it requires $_configuration['user_status_option_only_for_admin_enabled'] = true
/*$_configuration['user_status_option_show_only_for_admin'] = [
'COURSEMANAGER' => false,
'STUDENT' => false,
'DRH' => false,
'SESSIONADMIN' => true,
'STUDENT_BOSS' => false,
'INVITEE' => false
];*/


// KEEP THIS AT THE END
// -------- Custom DB changes
// Add user activation by confirmation email
Expand Down

0 comments on commit 33e4fbb

Please sign in to comment.