예제 #1
0
 /**
  * Gets auth and perm container objects back from session and tries
  * to give them an active database/whatever connection again.
  *
  * @return boolean true on success or false on failure
  *
  * @access private
  */
 function _unfreeze()
 {
     if (!$this->_options['session']['force_start']) {
         if (!isset($_REQUEST[$this->_options['session']['name']])) {
             return false;
         }
         $this->_startSession();
     }
     if (isset($_SESSION[$this->_options['session']['varname']]['auth']) && is_array($_SESSION[$this->_options['session']['varname']]['auth']) && isset($_SESSION[$this->_options['session']['varname']]['auth_name']) && strlen($_SESSION[$this->_options['session']['varname']]['auth_name']) > 0) {
         $containerName = $_SESSION[$this->_options['session']['varname']]['auth_name'];
         $auth =& LiveUser::authFactory($this->_authContainers[$containerName], $containerName);
         if ($auth === false) {
             return false;
         }
         if ($auth->unfreeze($_SESSION[$this->_options['session']['varname']]['auth'])) {
             $auth->backendArrayIndex = $_SESSION[$this->_options['session']['varname']]['auth_name'];
             $this->_auth =& $auth;
             if (isset($_SESSION[$this->_options['session']['varname']]['perm']) && $_SESSION[$this->_options['session']['varname']]['perm']) {
                 $perm =& LiveUser::permFactory($this->_permContainer);
                 if ($perm === false) {
                     return $perm;
                 }
                 if ($this->_options['cache_perm']) {
                     $result = $perm->unfreeze($this->_options['session']['varname']);
                 } else {
                     $result = $perm->mapUser($auth->getProperty('auth_user_id'), $auth->backendArrayIndex);
                 }
                 if ($result) {
                     $this->_perm =& $perm;
                 }
             }
             $this->_status = LIVEUSER_STATUS_UNFROZEN;
             $this->dispatcher->post($this, 'onUnfreeze');
             return true;
         }
     }
     return false;
 }
예제 #2
0
 /**
  * Gets auth and perm container objects back from session and tries
  * to give them an active database/whatever connection again.
  *
  * @return bool true on success or false on failure
  *
  * @access private
  */
 function _unfreeze()
 {
     if (!$this->_options['session']['force_start']) {
         if (!array_key_exists($this->_options['session']['name'], $_REQUEST)) {
             return false;
         }
         $this->_startSession();
     }
     if (isset($_SESSION[$this->_options['session']['varname']]) && array_key_exists('auth', $_SESSION[$this->_options['session']['varname']]) && is_array($_SESSION[$this->_options['session']['varname']]['auth']) && array_key_exists('auth_name', $_SESSION[$this->_options['session']['varname']]) && strlen($_SESSION[$this->_options['session']['varname']]['auth_name']) > 0) {
         $containerName = $_SESSION[$this->_options['session']['varname']]['auth_name'];
         $auth =& LiveUser::authFactory($this->_authContainers[$containerName], $containerName);
         if ($auth === false) {
             $this->stack->push(LIVEUSER_ERROR, 'exception', array('msg' => 'Could not instanciate auth container: ' . $containerName));
             return false;
         }
         if ($auth->unfreeze($_SESSION[$this->_options['session']['varname']]['auth'])) {
             $auth->containerName = $_SESSION[$this->_options['session']['varname']]['auth_name'];
             $this->_auth =& $auth;
             if (array_key_exists('perm', $_SESSION[$this->_options['session']['varname']]) && $_SESSION[$this->_options['session']['varname']]['perm']) {
                 $perm =& LiveUser::permFactory($this->_permContainer);
                 if ($perm === false) {
                     $this->stack->push(LIVEUSER_ERROR, 'exception', array('msg' => 'Could not instanciate perm container of type: ' . $this->_permContainer));
                     return $perm;
                 }
                 if ($this->_options['cache_perm']) {
                     $result = $perm->unfreeze($this->_options['session']['varname']);
                 } else {
                     $result = $perm->mapUser($auth->getProperty('auth_user_id'), $auth->containerName);
                 }
                 if ($result) {
                     $this->_perm =& $perm;
                 }
             }
             $this->_status = LIVEUSER_STATUS_UNFROZEN;
             $this->dispatcher->post($this, 'onUnfreeze');
             return true;
         }
     }
     return false;
 }
예제 #3
0
 /**
  * Sets the perm container
  *
  * Upon success it will return a perm instance. You can then
  * access the perm backend container by using the
  * perm properties of this class or the perm object directly.
  *
  * e.g.: $admin->perm->addUser(); or $perm->addUser();
  *
  * @return LiveUser_Admin_Perm_Simple|bool auth instance upon success, false otherwise
  *
  * @access public
  */
 function &setAdminPermContainer()
 {
     if (!array_key_exists('permContainer', $this->_conf)) {
         $this->stack->push(LIVEUSER_ADMIN_ERROR, 'exception', array('msg' => 'Could not create perm container instance'));
         $result = false;
         return $result;
     }
     $perm =& LiveUser::permFactory($this->_conf['permContainer'], 'LiveUser_Admin_');
     if ($perm === false) {
         $this->stack->push(LIVEUSER_ADMIN_ERROR, 'exception', array('msg' => 'Could not instanciate perm container of type: ' . $this->_conf['permContainer']['type']));
         return $perm;
     }
     $this->perm =& $perm;
     return $this->perm;
 }