當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。