|
|
|
@ -15,6 +15,8 @@ require_once __DIR__.'/../inc/global.inc.php'; |
|
|
|
|
api_protect_session_admin_list_users(); |
|
|
|
|
|
|
|
|
|
$urlId = api_get_current_access_url_id(); |
|
|
|
|
$currentUserId = api_get_user_id(); |
|
|
|
|
|
|
|
|
|
$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : ''; |
|
|
|
|
|
|
|
|
|
// Login as can be used by different roles |
|
|
|
@ -340,7 +342,7 @@ function prepare_user_sql_query($getCount) |
|
|
|
|
|
|
|
|
|
$preventSessionAdminsToManageAllUsers = api_get_setting('prevent_session_admins_to_manage_all_users'); |
|
|
|
|
if (api_is_session_admin() && $preventSessionAdminsToManageAllUsers === 'true') { |
|
|
|
|
$sql .= ' AND u.creator_id = '.api_get_user_id(); |
|
|
|
|
$sql .= ' AND u.creator_id = '.$currentUserId; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
$variables = Session::read('variables_to_show', []); |
|
|
|
@ -539,6 +541,8 @@ function modify_filter($user_id, $url_params, $row) |
|
|
|
|
$_admins_list = Session::read('admin_list', []); |
|
|
|
|
$is_admin = in_array($user_id, $_admins_list); |
|
|
|
|
$statusname = api_get_status_langvars(); |
|
|
|
|
$currentUserId = api_get_user_id(); |
|
|
|
|
|
|
|
|
|
$user_is_anonymous = false; |
|
|
|
|
$current_user_status_label = $row['7']; |
|
|
|
|
|
|
|
|
@ -716,7 +720,7 @@ function modify_filter($user_id, $url_params, $row) |
|
|
|
|
$allowDelete = api_get_configuration_value('allow_delete_user_for_session_admin'); |
|
|
|
|
|
|
|
|
|
if (api_is_session_admin() && $allowDelete) { |
|
|
|
|
if ($user_id != api_get_user_id() && |
|
|
|
|
if ($user_id != $currentUserId && |
|
|
|
|
!$user_is_anonymous && |
|
|
|
|
api_global_admin_can_edit_admin($user_id, null, true) |
|
|
|
|
) { |
|
|
|
@ -741,7 +745,7 @@ function modify_filter($user_id, $url_params, $row) |
|
|
|
|
). |
|
|
|
|
'</a>'; |
|
|
|
|
|
|
|
|
|
if ($user_id != api_get_user_id() && |
|
|
|
|
if ($user_id != $currentUserId && |
|
|
|
|
!$user_is_anonymous && |
|
|
|
|
api_global_admin_can_edit_admin($user_id) |
|
|
|
|
) { |
|
|
|
@ -757,7 +761,7 @@ function modify_filter($user_id, $url_params, $row) |
|
|
|
|
|
|
|
|
|
$deleteAllowed = !api_get_configuration_value('deny_delete_users'); |
|
|
|
|
if ($deleteAllowed) { |
|
|
|
|
if ($user_id != api_get_user_id() && |
|
|
|
|
if ($user_id != $currentUserId && |
|
|
|
|
!$user_is_anonymous && |
|
|
|
|
api_global_admin_can_edit_admin($user_id) |
|
|
|
|
) { |
|
|
|
@ -890,7 +894,7 @@ if (!empty($action)) { |
|
|
|
|
$number_of_affected_users = 0; |
|
|
|
|
if (is_array($_POST['id'])) { |
|
|
|
|
foreach ($_POST['id'] as $index => $user_id) { |
|
|
|
|
if ($user_id != $_user['user_id']) { |
|
|
|
|
if ($user_id != $currentUserId) { |
|
|
|
|
if (UserManager::delete_user($user_id)) { |
|
|
|
|
$number_of_affected_users++; |
|
|
|
|
} |
|
|
|
@ -916,7 +920,7 @@ if (!empty($action)) { |
|
|
|
|
$number_of_affected_users = 0; |
|
|
|
|
if (is_array($_POST['id'])) { |
|
|
|
|
foreach ($_POST['id'] as $index => $user_id) { |
|
|
|
|
if ($user_id != $_user['user_id']) { |
|
|
|
|
if ($user_id != $currentUserId) { |
|
|
|
|
if (UserManager::disable($user_id)) { |
|
|
|
|
$number_of_affected_users++; |
|
|
|
|
} |
|
|
|
@ -942,7 +946,7 @@ if (!empty($action)) { |
|
|
|
|
$number_of_affected_users = 0; |
|
|
|
|
if (is_array($_POST['id'])) { |
|
|
|
|
foreach ($_POST['id'] as $index => $user_id) { |
|
|
|
|
if ($user_id != $_user['user_id']) { |
|
|
|
|
if ($user_id != $currentUserId) { |
|
|
|
|
if (UserManager::enable($user_id)) { |
|
|
|
|
$number_of_affected_users++; |
|
|
|
|
} |
|
|
|
|