예제 #1
0
파일: util.php 프로젝트: uzura8/flockbird
 public static function check_exists_accessible_uri($paths)
 {
     if (!is_array($paths)) {
         if (!$paths) {
             return true;
         }
         if ($paths == '/') {
             return true;
         }
         return \Auth::has_access(\Site_Util::get_acl_path($paths) . '.GET');
     }
     foreach ($paths as $name => $path) {
         if (is_array($path)) {
             if (isset($path['href']) && isset($path['method']) && \Auth::has_access(\Site_Util::get_acl_path($path['href']) . '.' . $path['method'])) {
                 return true;
             }
         } else {
             if (\Auth::has_access(\Site_Util::get_acl_path($path) . '.GET')) {
                 return true;
             }
         }
     }
     return false;
 }
예제 #2
0
function check_acl($acl_path, $method = 'GET', $is_convert_acl_path = false)
{
    if ($is_convert_acl_path) {
        $acl_path = Site_Util::get_acl_path($acl_path);
    }
    return Auth::has_access($acl_path . '.' . $method);
}
예제 #3
0
파일: parts.php 프로젝트: uzura8/flockbird
function anchor($href, $text, $is_admin = false, $attr = array(), $is_absolute_ext_uri = false, $acl_method = 'GET')
{
    if (is_null($attr)) {
        $attr = array();
    }
    if ($is_absolute_ext_uri || ($is_ext_url = Site_Util::check_ext_uri($href, $is_admin))) {
        $attr['target'] = '_blank';
        $text .= ' ' . icon('new-window');
    }
    if ($is_admin && !$is_ext_url) {
        if (Auth::check() && !Auth::has_access(Site_Util::get_acl_path($href) . '.' . $acl_method)) {
            $attr['class'] = empty($attr['class']) ? '' : $attr['class'] . ' ';
            $attr['class'] .= 'disabled';
            return html_tag('span', $attr, $text);
        }
    }
    return Html::anchor($href, $text, $attr);
}