本文整理匯總了PHP中AllPermissionsOptimizationUtil::checkPermissionsHasAnyOf方法的典型用法代碼示例。如果您正苦於以下問題:PHP AllPermissionsOptimizationUtil::checkPermissionsHasAnyOf方法的具體用法?PHP AllPermissionsOptimizationUtil::checkPermissionsHasAnyOf怎麽用?PHP AllPermissionsOptimizationUtil::checkPermissionsHasAnyOf使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AllPermissionsOptimizationUtil
的用法示例。
在下文中一共展示了AllPermissionsOptimizationUtil::checkPermissionsHasAnyOf方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: checkPermissionsHasAnyOf
public function checkPermissionsHasAnyOf($requiredPermissions, User $user = null)
{
assert('is_int($requiredPermissions)');
assert('in_array($requiredPermissions,
array(Permission::READ, Permission::WRITE, Permission::DELETE,
Permission::CHANGE_PERMISSIONS, Permission::CHANGE_OWNER))');
if ($user == null) {
$user = Yii::app()->user->userModel;
}
if (Permission::ALL == $this->resolveEffectivePermissionsForOwnerAndCreatedByUser($user)) {
return;
} elseif ($this->isDeleting) {
//Avoid potential problems with accessing information already removed from munge.
//Potentially there could be some gap with doing this, but it improves performance on complex
//role/group setups.
return;
} else {
if (SECURITY_OPTIMIZED) {
$modelClassName = get_called_class();
$moduleClassName = $modelClassName::getModuleClassName();
if (static::hasReadPermissionsOptimization() && $moduleClassName != null && is_subclass_of($moduleClassName, 'SecurableModule') && AllPermissionsOptimizationUtil::checkPermissionsHasAnyOf($requiredPermissions, $this, $user)) {
return;
}
}
parent::checkPermissionsHasAnyOf($requiredPermissions, $user);
}
}