本文整理汇总了PHP中ACL::is_action_allowed方法的典型用法代码示例。如果您正苦于以下问题:PHP ACL::is_action_allowed方法的具体用法?PHP ACL::is_action_allowed怎么用?PHP ACL::is_action_allowed使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ACL
的用法示例。
在下文中一共展示了ACL::is_action_allowed方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: before
public function before()
{
parent::before();
if (!ACL::is_action_allowed($this->request->directory(), $this->request->controller(), $this->request->action())) {
$this->on_auth_error();
}
$this->_user = Auth::instance()->get_user();
}
示例2: action_index
public function action_index()
{
foreach ($this->_group_actions as $action => $cfg) {
if (!ACL::is_action_allowed($this->request->directory(), $this->request->controller(), $action)) {
unset($this->_group_actions[$action]);
}
}
if (isset($_POST['group_actions'])) {
$action = NULL;
foreach (arr::get($_POST, 'action', array()) as $name => $value) {
$action = $name;
}
$handler = arr::path($this->_group_actions, $action . '.handler');
if ($action && $handler && method_exists($this, $handler)) {
if (arr::path($this->_group_actions, $action . '.one_item')) {
foreach ($_POST['ids'] as $id) {
$item = ORM::factory($this->_model, $id);
if ($item->loaded()) {
$this->{$handler}($item);
}
}
} else {
$ids = array();
foreach ($_POST['ids'] as $id) {
if ($id) {
$ids[] = $id;
}
}
if (count($ids)) {
$this->{$handler}($ids);
}
}
}
$this->back($this->get_index_route());
}
$this->set_view('crud/index');
Navigation::instance()->actions()->add($this->get_create_route(), 'Добавить');
$model = ORM::factory($this->_model);
$this->template->filter_form = $this->get_filter_form($model);
if ($this->template->filter_form) {
$this->template->filter_form->set_method('GET');
if (isset($_GET['filter_cancel'])) {
$this->redirect('/' . Extasy_Url::url_to_route($this->get_index_route()));
}
if (isset($_GET['filter'])) {
$this->template->filter_form->submit();
}
}
$this->template->unSortableFields = $model->getUnSortableSortableFields();
$grid = $this->before_fetch($model)->grid()->set_group_actions($this->_group_actions);
$this->template->grid = $this->prepare_grid($grid);
}
示例3: action_index
public function action_index()
{
$write_allowed = ACL::is_action_allowed('admin', 'config', 'write');
$this->template->write_allowed = $write_allowed;
if (isset($_POST['cancel'])) {
$this->redirect('/' . Extasy_Url::url_to_route('admin-config'));
}
$form = new Form_Config();
if (!$write_allowed) {
$form->set_read_only();
}
if ($write_allowed and isset($_POST['submit']) and $form->submit()) {
$this->redirect('/' . Extasy_Url::url_to_route('admin-config'));
}
$this->template->form = $form;
}