Beispiel #1
0
 public function runAs($userId, $call, array $args = array())
 {
     $origUser = $this->_loggedUser;
     $exception = NULL;
     if ($this->_runAs) {
         throw new RM_Base_Exception_BadUsage("Nested runAs() is prohibited!");
     }
     $this->_runAs = 1;
     $this->_loggedUser = $this->_engine->loadUserById($userId);
     // change user context
     try {
         $result = call_user_func_array($call, $args);
     } catch (Exception $e) {
         $exception = $e;
     }
     $this->_loggedUser = $origUser;
     // restore user context
     $this->_runAs = 0;
     if ($exception) {
         throw $exception;
     }
     return $result;
 }
Beispiel #2
0
 public function loadByLogin($login)
 {
     deprecated();
     return $this->_engine->loadUserByLogin($login);
 }