本文整理匯總了PHP中Authority::resource_has_rule方法的典型用法代碼示例。如果您正苦於以下問題:PHP Authority::resource_has_rule方法的具體用法?PHP Authority::resource_has_rule怎麽用?PHP Authority::resource_has_rule使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Authority
的用法示例。
在下文中一共展示了Authority::resource_has_rule方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: authority_protect
/**
* If the resource has one rule, checks if the User has access to the resource.
* If not and $return is FALSE, displays the defined view.
* If no view is defined, displays the default deny view.
*
* Only returns TRUE/FALSE is $return is set to TRUE.
*
* @param $resource
* @param null $view
* @param bool $return
*
* @return bool
*/
public function authority_protect($resource, $view = NULL, $return = FALSE)
{
if (Authority::resource_has_rule($resource)) {
if (Authority::cannot('access', $resource)) {
if (!$return) {
if (is_null($view)) {
$view = self::$_DENY_DEFAULT_VIEW;
}
$this->output($view);
}
return FALSE;
}
}
return TRUE;
}
示例2: lang
<?php
if (Authority::can('create', 'admin/page') && Authority::can('add_page', 'admin/tree/menu')) {
?>
<a title="<?php
echo lang('ionize_help_add_page_to_menu');
?>
" class="icon right ml5 add_page" data-id="<?php
echo $menu['id_menu'];
?>
"></a>
<?php
}
?>
</span>
<span <?php
if (Authority::resource_has_rule('backend/menu/' . $menu['id_menu'])) {
?>
class="locked"<?php
}
?>
><?php
echo $menu['title'];
?>
</span>
</h3>
<div class="treeContainer" id="<?php
echo $menu['name'] . 'Tree';
?>
" data-id-menu="<?php
echo $menu['id_menu'];
?>