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


PHP CWebUser::checkAccess方法代码示例

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


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

示例1: checkAccess

 /**
  * Performs access check for this user.
  * @param string $operation the name of the operation that need access check.
  * @param array $params name-value pairs that would be passed to business rules associated
  * with the tasks and roles assigned to the user.
  * @param boolean $allowCaching whether to allow caching the result of access check.
  * @return boolean whether the operations can be performed by this user.
  */
 public function checkAccess($operation, $params = array(), $allowCaching = true)
 {
     if ($this->getIsAdmin()) {
         return true;
     }
     return parent::checkAccess($operation, $params, $allowCaching);
 }
开发者ID:GsHatRed,项目名称:Yiitest,代码行数:15,代码来源:AuthWebUser.php

示例2: checkAccess

	public function checkAccess($operation, $params=array(), $allowCaching=true)
	{
		if(!Yum::hasModule('role') ||	Yum::module('role')->useYiiCheckAccess )
			return parent::checkAccess($operation, $params, $allowCaching);

		return $this->can($operation);	
	}
开发者ID:richardh68,项目名称:yii-user-management,代码行数:7,代码来源:YumWebUser.php

示例3: checkAccess

 public function checkAccess($operation, $params = array(), $allowCaching = true)
 {
     if ($operation === 'admin') {
         return $this->isAdmin();
     }
     return parent::checkAccess($operation, $params, $allowCaching);
 }
开发者ID:qyt1988528,项目名称:union,代码行数:7,代码来源:WebUser.php

示例4: checkAccess

 public function checkAccess($operation, $params = array(), $allowCaching = true)
 {
     if ($operation == 'administrator') {
         return Permission::model()->hasGlobalPermission('superadmin', 'read');
     } else {
         return parent::checkAccess($operation, $params, $allowCaching);
     }
 }
开发者ID:jdbaltazar,项目名称:survey-office,代码行数:8,代码来源:LSWebUser.php

示例5: isCustomer

 public function isCustomer()
 {
     if ($this->_isCustomer === null) {
         $customer_user_role = Yii::app()->getModule('user')->customerUser['role'];
         $this->_isCustomer = parent::checkAccess($customer_user_role);
     }
     return $this->_isCustomer;
 }
开发者ID:uldisn,项目名称:yii-user,代码行数:8,代码来源:d2RWebUser.php

示例6: checkAccess

 public function checkAccess($auth_item_name, $params = array(), $allow_caching = true)
 {
     return true;
     if (Yii::app()->user->isRootRole()) {
         return true;
     }
     $auth_item = AuthItem::model()->findByPk($auth_item_name);
     if ($auth_item && $auth_item['allow_for_all']) {
         return true;
     }
     return parent::checkAccess($auth_item_name, $params, $allow_caching);
 }
开发者ID:blindest,项目名称:Yii-CMS-2.0,代码行数:12,代码来源:WebUser.php

示例7: checkAccess

 public function checkAccess($name, $userId = array())
 {
     if (!Yii::app()->user->isAdmin) {
         return false;
     }
     switch ($name) {
         case 'view':
         case 'update':
         case 'create':
         case 'delete':
             return parent::checkAccess($name . '_' . ucfirst(Yii::app()->controller->id));
     }
     return parent::checkAccess($name, $userId);
 }
开发者ID:jasonhai,项目名称:onehome,代码行数:14,代码来源:WebUser.php

示例8: checkAccess

 public function checkAccess($operation, $params = array(), $allowCaching = true)
 {
     if (Yii::app()->getModule('srbac')->isInstalled()) {
         //Always allow access if $access is in the allowedAccess array
         if (in_array($operation, $this->allowedAccess())) {
             return true;
         }
         //Allow access when srbac is in debug mode
         if (Yii::app()->getModule('srbac')->debug) {
             return true;
         }
     }
     return parent::checkAccess($operation, $params, $allowCaching);
 }
开发者ID:CHILMEX,项目名称:amocasion,代码行数:14,代码来源:SrbacWebUser.php

示例9: checkAccess

 /**
  * Performs access check for this user.
  * Overloads the parent method in order to allow superusers access implicitly.
  * @param string $operation the name of the operation that need access check.
  * @param array $params name-value pairs that would be passed to business rules associated
  * with the tasks and roles assigned to the user.
  * @param boolean $allowCaching whether to allow caching the result of access checki.
  * This parameter has been available since version 1.0.5. When this parameter
  * is true (default), if the access check of an operation was performed before,
  * its result will be directly returned when calling this method to check the same operation.
  * If this parameter is false, this method will always call {@link CAuthManager::checkAccess}
  * to obtain the up-to-date access result. Note that this caching is effective
  * only within the same request.
  * @return boolean whether the operations can be performed by this user.
  */
 public function checkAccess($operation, $params = array(), $allowCaching = true)
 {
     // Allow superusers access implicitly and do CWebUser::checkAccess for others.
     return $this->isSuperuser === true ? true : parent::checkAccess($operation, $params, $allowCaching);
 }
开发者ID:fobihz,项目名称:cndiesel,代码行数:20,代码来源:RWebUser.php

示例10: checkAccess

 /**
  * Check if we have the access keys in the db
  *
  */
 public function checkAccess($operation, $params = array())
 {
     // First make sure we haven't already added it
     // without looking in the db
     $missingRoles = array();
     if (Yii::app()->cache) {
         $missingRoles = Yii::app()->cache->get('missing_roles');
         if ($missingRoles === false) {
             $missingRoles = array();
         }
     }
     // Do we have that roles in the array
     if (!in_array($operation, $missingRoles)) {
         // We don't so look up the db
         $roleExists = AuthItem::model()->find('name=:name', array(':name' => $operation));
         if (!$roleExists) {
             // Figure out the type first
             if (strpos($operation, 'op_') !== false) {
                 $type = CAuthItem::TYPE_OPERATION;
             } elseif (strpos($operation, 'task_') !== false) {
                 $type = CAuthItem::TYPE_TASK;
             } else {
                 $type = CAuthItem::TYPE_ROLE;
             }
             // Create new auth item
             Yii::app()->authManager->createAuthItem($operation, $type, $operation, null, null);
         }
         $missingRoles[$operation] = $operation;
         // Save
         if (Yii::app()->cache) {
             Yii::app()->cache->set('missing_roles', $missingRoles);
         }
     }
     // In case we are in debug mode then return true all the time
     if (YII_DEBUG) {
         return true;
     }
     // Return parent check access
     return parent::checkAccess($operation, $params);
 }
开发者ID:YiiCoded,项目名称:yii-ecommerce,代码行数:44,代码来源:WebUser.php

示例11: checkAccessWithCache

 public function checkAccessWithCache($operation, $params = array(), $allowCaching = true)
 {
     $permissions = Yii::app()->cache->get('permission-cache');
     if ($permissions !== false) {
         if (!array_key_exists($operation, $permissions)) {
             return false;
         }
         if ($this->executeBizRule($permissions[$operation]['bizrule'], $params, $permissions[$operation]['data'])) {
             //Check with default Roles
             if (in_array(app()->authManager->defaultRoles, $permissions[$operation]['roles'])) {
                 return true;
             }
             //Check if allow user id for current operation
             if (array_key_exists($this->getId(), $permissions[$operation]['users'])) {
                 $uid = $this->getId();
                 if ($this->executeBizRule($permissions[$operation]['users'][$uid]['bizrule'], $params, $permissions[$operation]['users'][$uid]['data'])) {
                     return true;
                 }
             }
             if ($this->getState('current_roles')) {
                 //Check if allow user id for current operation
                 $check_roles = array_intersect($this->getState('current_roles'), $permissions[$operation]['roles']);
                 return count($check_roles) > 0;
             } else {
                 return false;
             }
         }
     } else {
         parent::checkAccess($operation, $params, $allowCaching);
     }
 }
开发者ID:pramana08,项目名称:GXC-CMS-2,代码行数:31,代码来源:GxcUser.php

示例12: checkAccess

 public function checkAccess($operation, $params = array(), $allowCaching = true)
 {
     return parent::checkAccess($operation, $params, $allowCaching);
 }
开发者ID:kinghinds,项目名称:kingtest2,代码行数:4,代码来源:WebUser.php


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