当前位置: 首页>>代码示例>>PHP>>正文


PHP LiveUser::authFactory方法代码示例

本文整理汇总了PHP中LiveUser::authFactory方法的典型用法代码示例。如果您正苦于以下问题:PHP LiveUser::authFactory方法的具体用法?PHP LiveUser::authFactory怎么用?PHP LiveUser::authFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LiveUser的用法示例。


在下文中一共展示了LiveUser::authFactory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _unfreeze

 /**
  * 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;
 }
开发者ID:Zunair,项目名称:xataface,代码行数:46,代码来源:LiveUser.php

示例2: _unfreeze

 /**
  * 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;
 }
开发者ID:laiello,项目名称:punchcms,代码行数:48,代码来源:LiveUser.php

示例3: init

 /**
  * Setup backend container.
  *
  * Upon success it will return true. You can then
  * access the backend container by using the auth
  * and perm properties of this class.
  *
  * e.g.: $admin->perm->getUsers();
  *
  * @param int user auth id
  * @param  string auth container name
  * @return bool true upon success, false otherwise
  *
  * @access public
  */
 function init($authUserId = null, $authName = null)
 {
     if (!is_array($this->_conf)) {
         $this->stack->push(LIVEUSER_ADMIN_ERROR, 'exception', array('msg' => 'Missing configuration array'));
         return false;
     }
     if (is_null($authName)) {
         if (is_null($authUserId)) {
             reset($this->_conf['authContainers']);
             $authName = key($this->_conf['authContainers']);
         } else {
             foreach ($this->_conf['authContainers'] as $key => $value) {
                 if (!isset($this->_authContainers[$key]) || !is_object($this->_authContainers[$key])) {
                     $auth =& LiveUser::authFactory($value, $key, 'LiveUser_Admin_');
                     if ($auth === false) {
                         $this->stack->push(LIVEUSER_ADMIN_ERROR, 'exception', array('msg' => 'Could not instanciate auth container: ' . $key));
                         return $auth;
                     }
                     $this->_authContainers[$key] =& $auth;
                 }
                 if (!is_null($authUserId)) {
                     $match = $this->_authContainers[$key]->getUsers(array('filters' => array('auth_user_id' => $authUserId)));
                     if (is_array($match) && count($match) > 0) {
                         $authName = $key;
                         break;
                     }
                 }
             }
         }
         if (!isset($authName)) {
             $this->stack->push(LIVEUSER_ADMIN_ERROR, 'exception', array('msg' => 'Could not determine what auth container to use'));
             return false;
         }
     }
     if (!$this->setAdminAuthContainer($authName)) {
         return false;
     }
     if (!isset($this->perm) || !is_object($this->perm)) {
         if (!$this->setAdminPermContainer()) {
             return false;
         }
     }
     return true;
 }
开发者ID:ookwudili,项目名称:chisimba,代码行数:59,代码来源:Admin.php


注:本文中的LiveUser::authFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。