本文整理汇总了PHP中Acl::getUserPermissionLevel方法的典型用法代码示例。如果您正苦于以下问题:PHP Acl::getUserPermissionLevel方法的具体用法?PHP Acl::getUserPermissionLevel怎么用?PHP Acl::getUserPermissionLevel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Acl
的用法示例。
在下文中一共展示了Acl::getUserPermissionLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllUserDefaultModels
/**
* Get all models that should exist by default for a user.
*
* @param int $user_id
* @return \GO\Base\Db\ActiveRecord
*/
public static function getAllUserDefaultModels($user_id = 0)
{
$oldIgnoreAcl = \GO::setIgnoreAclPermissions(true);
if (!isset(self::$_allUserDefaultModels)) {
self::$_allUserDefaultModels = array();
$modules = \GO::modules()->getAllModules();
while ($module = array_shift($modules)) {
$permissionLevel = $user_id ? Acl::getUserPermissionLevel($module->acl_id, $user_id) : 1;
if ($permissionLevel) {
if ($module->moduleManager) {
$classes = $module->moduleManager->findClasses('model');
foreach ($classes as $class) {
if ($class->isSubclassOf('GO\\Base\\Model\\AbstractUserDefaultModel')) {
self::$_allUserDefaultModels[] = \GO::getModel($class->getName());
}
}
}
}
}
}
\GO::setIgnoreAclPermissions($oldIgnoreAcl);
return self::$_allUserDefaultModels;
}
示例2: getUserLevel
/**
* Return the permission level that a user has for this ACL.
*
* @param int $userId If omitted then it will check the currently logged in user and return manage permission if \GO::$ignoreAclPermissions is set.
* @param bool $checkGroupPermissionOnly
* @return int Permission level. See constants in Acl for values.
*/
public function getUserLevel($userId)
{
return Acl::getUserPermissionLevel($this->id, $userId);
}