当前位置: 首页>>代码示例>>PHP>>正文


PHP Permissions::hasPermission方法代码示例

本文整理汇总了PHP中Permissions::hasPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP Permissions::hasPermission方法的具体用法?PHP Permissions::hasPermission怎么用?PHP Permissions::hasPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Permissions的用法示例。


在下文中一共展示了Permissions::hasPermission方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get

 public static function get($route)
 {
     if (strpos($route, '/') !== false) {
         list($folder, $route) = explode('/', $route);
     }
     if (strpos($route, ':') !== false) {
         list($controller, $method) = explode(':', $route);
     } else {
         $controller = $route;
         $method = 'index';
     }
     $controller = ucfirst($controller) . 'Controller';
     $admin = isset($folder) && $folder == 'admin' ? true : false;
     $user = self::$app['session']->get('user');
     if ($admin) {
         if (!$user || !Permissions::hasPermission('ACCESS_ADMIN')) {
             return self::$app->redirect('/');
         }
     }
     $path = (isset($folder) ? 'Controller\\' . ucfirst($folder) . '\\' : 'Controller\\') . $controller;
     if (!class_exists($path)) {
         throw new \Exception($controller . ' does not exist in ' . $path);
     }
     $controller = new $path(self::$app);
     $params = func_get_args();
     array_shift($params);
     return call_user_func_array(array($controller, $method), $params);
 }
开发者ID:luismabenitez,项目名称:asimpleforum,代码行数:28,代码来源:Route.php

示例2: trans

            }
            if ($path == "customer/tickets" && $blocking->should_block_tickets) {
                return trans('msgs.you_dont_have_tickets_access');
            }
        }
    }
});
Route::filter('has_permission', function ($route, $request, $permission) {
    if (Auth::check()) {
        if (!\KodeInfo\Utilities\Utils::canViewBackend(Auth::user()->id)) {
            Auth::logout();
            Session::flush();
            Session::flash('error_msg', trans('msgs.access_denied_escalate_rights'));
            return Redirect::to('/login');
        }
        if (!Permissions::hasPermission($permission)) {
            $permission_obj = Permissions::where('key', $permission)->pluck('text');
            Session::flash('error_msg', trans('msgs.access_denied_escalate_rights', ['permission_obj' => $permission_obj]));
            return Redirect::to('/dashboard');
        }
    } else {
        Session::flash('error_msg', trans('msgs.please_login_to_continue'));
        return Redirect::to('/login');
    }
});
Route::filter('backend', function () {
    if (Auth::check()) {
        if (!\KodeInfo\Utilities\Utils::canViewBackend(Auth::user()->id)) {
            Auth::logout();
            Session::flush();
            Session::flash('error_msg', trans('msgs.access_denied_escalate_rights'));
开发者ID:noikiy,项目名称:Xenon-Support-Center,代码行数:31,代码来源:filters.php

示例3: hasAnyBlockingPermissions

 static function hasAnyBlockingPermissions()
 {
     if (Permissions::hasPermission('blocking.block') || Permissions::hasPermission('blocking.all') || Permissions::hasPermission('blocking.delete')) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:noikiy,项目名称:Xenon-Support-Center,代码行数:8,代码来源:Permissions.php


注:本文中的Permissions::hasPermission方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。