Skip to content
Permalink
Browse files

Add allow_session_admin_login_as_teacher conf setting - refs BT#15095

Allow to session admins login as teachers
  • Loading branch information...
AngelFQC committed Dec 11, 2018
1 parent 8d88b9d commit dbc571c72b73e1a223699c2ed571e84fad65b210
Showing with 21 additions and 2 deletions.
  1. +9 −1 main/admin/user_list.php
  2. +9 −1 main/inc/lib/api.lib.php
  3. +3 −0 main/install/configuration.dist.php
@@ -578,7 +578,15 @@ function modify_filter($user_id, $url_params, $row)
}
//only allow platform admins to login_as, or session admins only for students (not teachers nor other admins)
$sessionAdminCanLoginAs = api_is_session_admin() && $current_user_status_label == $statusname[STUDENT];
$loginAsStatusForSessionAdmins = [$statusname[STUDENT]];
//except when allow_session_admin_login_as_teacher is enabled, then can login_as teachers also
if (api_get_configuration_value('allow_session_admin_login_as_teacher')) {
$loginAsStatusForSessionAdmins[] = $statusname[COURSEMANAGER];
}
$sessionAdminCanLoginAs = api_is_session_admin() &&
in_array($current_user_status_label, $loginAsStatusForSessionAdmins);
if (api_is_platform_admin() || $sessionAdminCanLoginAs) {
if (!$user_is_anonymous) {
@@ -8305,7 +8305,15 @@ function api_can_login_as($loginAsUserId, $userId = null)
return false;
};
return api_is_platform_admin() || (api_is_session_admin() && $userInfo['status'] == 5) || $isDrh();
$loginAsStatusForSessionAdmins = [STUDENT];
if (api_get_configuration_value('allow_session_admin_login_as_teacher')) {
$loginAsStatusForSessionAdmins[] = COURSEMANAGER;
}
return api_is_platform_admin() ||
(api_is_session_admin() && in_array($userInfo['status'], $loginAsStatusForSessionAdmins)) ||
$isDrh();
}
/**
@@ -1056,6 +1056,9 @@
// Create a new session extra field called "collapsed" (checkbox yes/no - option)
// $_configuration['allow_user_session_collapsable'] = false;
// Allow to session admins login as teachers
//$_configuration['allow_session_admin_login_as_teacher'] = false;
// ------ Custom DB changes (keep this at the end)
// Add user activation by confirmation email
// This option prevents the new user to login in the platform if your account is not confirmed via email

0 comments on commit dbc571c

Please sign in to comment.
You can’t perform that action at this time.