Skip to content

Commit

Permalink
fixed bug in user-assignement
Browse files Browse the repository at this point in the history
  • Loading branch information
chfsx committed Feb 26, 2016
1 parent 81e7339 commit 6f335e8
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions classes/class.usrtoHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public function setTemporaryUsrId($temporary_usr_id) {
/**
* @return bool
*/
public function isTakenOver()
{
public function isTakenOver() {
return (isset($_SESSION[self::USR_ID_BACKUP]));
}

Expand All @@ -86,7 +85,7 @@ public function isTakenOver()
*/
public function takeOver($usr_id) {
global $ilUser, $ilLog;
$this->checkAccess();
$this->checkAccess($ilUser->getId());
$this->setTemporaryUsrId($usr_id);
$this->setOriginalUsrId($ilUser->getId());
$pl = ilUserTakeOverPlugin::getInstance();
Expand Down Expand Up @@ -119,14 +118,18 @@ public function switchBack() {
}


protected function checkAccess() {
/**
* @param $usr_id
* @return bool
*/
protected function checkAccess($usr_id) {
global $rbacreview;
$pl = ilUserTakeOverPlugin::getInstance();
if (!in_array(2, $rbacreview->assignedGlobalRoles($this->getOriginalUsrId()))) {
if (!isset($usr_id) || !in_array(2, $rbacreview->assignedGlobalRoles($usr_id))) {
ilUtil::sendFailure($pl->txt('no_permission'), true);
ilUtil::redirect('login.php');

return false;
}
}
}
}

0 comments on commit 6f335e8

Please sign in to comment.