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


PHP BaseUser::getSession方法代码示例

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


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

示例1: _checkFlagFlippers

 /**
  * Queries the Flag and Flipper and redirects the user to a different
  * page if he/her doesn't have the required permissions for
  * accessing the current page
  * 
  * @access protected
  * @return void
  */
 protected function _checkFlagFlippers()
 {
     $controllerName = Zend_Registry::get('controllerName');
     $actionName = Zend_Registry::get('actionName');
     $user = BaseUser::getSession();
     if (Zend_Registry::get('IS_DEVELOPMENT') && $controllerName != 'error') {
         $flagModel = new Flag();
         $flag = strtolower(CURRENT_MODULE) . '-' . $controllerName;
         if (!$flagModel->checkRegistered($flag, App_Inflector::camelCaseToDash($actionName))) {
             $params = array('originalController' => $controllerName, 'originalAction' => $actionName);
             $this->_forward('flagflippers', 'error', NULL, $params);
             return;
         }
     }
     //Check the flag and flippers for ZFDebug
     if (!App_FlagFlippers_Manager::isAllowed($user->group->name, 'testing', 'zfdebug')) {
         Zend_Controller_Front::getInstance()->unregisterPlugin('ZFDebug_Controller_Plugin_Debug');
     }
     if (!App_FlagFlippers_Manager::isAllowed($user->group->name, $controllerName, $actionName)) {
         if (empty($user->id)) {
             // the user is a guest, save the request and redirect him to
             // the login page
             $session = new Zend_Session_Namespace('FrontendRequest');
             $session->request = serialize($this->getRequest());
             if (Zend_Controller_Front::getInstance()->getRequest()->getModuleName() == "frontend") {
                 $this->_redirect($this->view->url(array('module' => 'frontend', 'controller' => 'user', 'action' => 'login'), 'default', true));
             } else {
                 $this->_redirect('/profile/login/');
             }
         } else {
             $this->_redirect('/error/forbidden/');
         }
     }
 }
开发者ID:omusico,项目名称:logica,代码行数:42,代码来源:Controller.php

示例2: isAllowed

 /**
  * Check if a role is allowed for a certain resource
  *
  * @param string $role 
  * @param string $resource 
  * @return boolean
  */
 public static function isAllowed($role = NULL, $resource = NULL, $action = NULL)
 {
     if (empty($role)) {
         $user = BaseUser::getSession();
         $role = $user->group->name;
     }
     if (!empty($resource)) {
         $resource = strtolower(CURRENT_MODULE) . '-' . $resource;
     }
     if (!empty($action)) {
         $action = App_Inflector::camelCaseToDash($action);
     }
     return App_FlagFlippers_Manager::_getFromRegistry()->isAllowed($role, $resource, $action);
 }
开发者ID:omusico,项目名称:logica,代码行数:21,代码来源:Manager.php

示例3: isLogged

 /**
  * Check if the current user is logged
  *
  * @return void
  */
 public static function isLogged()
 {
     $user = BaseUser::getSession();
     return isset($user->id);
 }
开发者ID:nic162,项目名称:Zend-Framework-Skeleton,代码行数:10,代码来源:BaseUser.php


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