From 1161792b6db386f20779296ace7aa096a823fda2 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Wed, 14 Oct 2015 19:15:16 -0500 Subject: [PATCH 1/3] Fix issue subscribing sessions to platform admin - refs CT#7899 --- main/inc/lib/sessionmanager.lib.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/main/inc/lib/sessionmanager.lib.php b/main/inc/lib/sessionmanager.lib.php index 675b5388bb..34bb454788 100755 --- a/main/inc/lib/sessionmanager.lib.php +++ b/main/inc/lib/sessionmanager.lib.php @@ -2852,13 +2852,22 @@ class SessionManager $tbl_session_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_SESSION); if (empty($userInfo)) { + return 0; } $userId = $userInfo['user_id']; // Only subscribe DRH users. - if ($userInfo['status'] != DRH) { + $rolesAllowed = array( + DRH, + SESSIONADMIN, + PLATFORM_ADMIN, + COURSE_TUTOR + ); + $isAdmin = api_is_platform_admin_by_id($userInfo['user_id']); + if (!$isAdmin && !in_array($userInfo['status'], $rolesAllowed)) { + return 0; } @@ -2903,6 +2912,7 @@ class SessionManager '" . SESSION_RELATION_TYPE_RRHH . "', '" . api_get_utc_datetime() . "' )"; + Database::query($sql); $affected_rows++; } From bbb33262aa726689697e387de04af78431e5cd68 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Wed, 14 Oct 2015 21:40:57 -0500 Subject: [PATCH 2/3] Fix issue subscribing users to platform admin - refs CT#7899 --- main/admin/dashboard_add_users_to_user.php | 16 ++++++++++++---- main/inc/lib/usermanager.lib.php | 5 +---- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/main/admin/dashboard_add_users_to_user.php b/main/admin/dashboard_add_users_to_user.php index 88b7f10604..eaee66b337 100755 --- a/main/admin/dashboard_add_users_to_user.php +++ b/main/admin/dashboard_add_users_to_user.php @@ -40,7 +40,9 @@ $userStatus = api_get_user_status($user_id); $firstLetterUser = isset($_POST['firstLetterUser']) ? $_POST['firstLetterUser'] : null; // setting the name of the tool -if (UserManager::is_admin($user_id)) { +$isAdmin = UserManager::is_admin($user_id); +if ($isAdmin) { + $userStatus = PLATFORM_ADMIN; $tool_name= get_lang('AssignUsersToPlatformAdministrator'); } else if ($user_info['status'] == SESSIONADMIN) { $tool_name= get_lang('AssignUsersToSessionsAdministrator'); @@ -59,7 +61,7 @@ if (!api_is_platform_admin()) { api_not_allowed(true); } -function search_users($needle,$type) +function search_users($needle, $type) { global $tbl_access_url_rel_user, $tbl_user, $user_anonymous, $current_user_id, $user_id, $userStatus; @@ -70,6 +72,8 @@ function search_users($needle,$type) switch ($userStatus) { case DRH: + //no break; + case PLATFORM_ADMIN: $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id); break; case STUDENT_BOSS: @@ -284,9 +288,11 @@ if (isset($_POST['formSent']) && intval($_POST['formSent']) == 1) { switch ($userStatus) { case DRH: + //no break; + case PLATFORM_ADMIN: $affected_rows = UserManager::suscribe_users_to_hr_manager($user_id, $user_list); break; - case STUDENT_BOSS; + case STUDENT_BOSS: $affected_rows = UserManager::subscribeUsersToBoss($user_id, $user_list); break; default: @@ -331,9 +337,11 @@ $assigned_users_to_hrm = array(); switch ($userStatus) { case DRH: + //no break; + case PLATFORM_ADMIN: $assigned_users_to_hrm = UserManager::get_users_followed_by_drh($user_id); break; - case STUDENT_BOSS; + case STUDENT_BOSS: $assigned_users_to_hrm = UserManager::getUsersFollowedByStudentBoss($user_id); break; } diff --git a/main/inc/lib/usermanager.lib.php b/main/inc/lib/usermanager.lib.php index af878c390d..7bb4c9b0d3 100755 --- a/main/inc/lib/usermanager.lib.php +++ b/main/inc/lib/usermanager.lib.php @@ -3974,7 +3974,7 @@ class UserManager $drhConditions = null; $teacherSelect = null; - switch($status) { + switch ($status) { case DRH: $drhConditions .= " AND friend_user_id = '$userId' AND @@ -4057,7 +4057,6 @@ class UserManager if ($getSql) { return $sql; } - if ($getCount) { $result = Database::query($sql); $row = Database::fetch_array($result); @@ -4079,7 +4078,6 @@ class UserManager $sql .= $orderBy; $sql .= $limitCondition; - $result = Database::query($sql); $users = array(); if (Database::num_rows($result) > 0) { @@ -4130,7 +4128,6 @@ class UserManager . "WHERE friend_user_id = $userId " . "AND relation_type = $relationType"; } - $result = Database::query($sql); if (Database::num_rows($result) > 0) { From 522d2675615130a8033c7b8448f81cd8ab406eb1 Mon Sep 17 00:00:00 2001 From: Yannick Warnier Date: Wed, 14 Oct 2015 21:43:38 -0500 Subject: [PATCH 3/3] Update languages --- main/lang/french/trad4all.inc.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/main/lang/french/trad4all.inc.php b/main/lang/french/trad4all.inc.php index f82f141147..e3cdeec419 100644 --- a/main/lang/french/trad4all.inc.php +++ b/main/lang/french/trad4all.inc.php @@ -7552,4 +7552,6 @@ $SkillAcquiredAt = "Compétence acquise le"; $BasicSkills = "Compétences simples"; $TimeXThroughCourseY = "%s par le cours %s"; $ExportBadge = "Exporter ce badge"; +$SelectToSearch = "Inclure dans la recherche"; +$PlaceOnTheWheel = "Localiser sur la roue"; ?> \ No newline at end of file