예제 #1
0
 /**
  * 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
0
파일: tree.php 프로젝트: trk/ionize
					<?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'];
            ?>