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


PHP Sentry::hasAccess方法代码示例

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


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

示例1: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle(Request $request, Closure $next)
 {
     if (!\Sentry::check() || !\Sentry::hasAccess('superuser')) {
         if ($request->ajax()) {
             return response('Unauthorized.', 401);
         } else {
             return redirect()->route('account.login');
         }
     }
     return $next($request);
 }
开发者ID:rafaelvieiras,项目名称:connect,代码行数:18,代码来源:Superuser.php

示例2: switch

        switch ($rule) {
            case 'index':
            case 'show':
                $userRule = $module . '.view';
                break;
            case 'create':
            case 'store':
                $userRule = $module . '.create';
                break;
            case 'edit':
            case 'update':
                $userRule = $module . '.update';
                break;
            case 'destroy':
                $userRule = $module . '.delete';
                break;
            default:
                $userRule = Route::currentRouteName();
                break;
        }
    }
    // no access to the request page and request page not the root admin page
    if (!Sentry::hasAccess($userRule) and $userRule !== 'admin.view') {
        return Redirect::to('admin')->with('error', Lang::get('backend::permissions.access_denied'));
    } else {
        if (!Sentry::hasAccess($userRule) and $userRule === 'admin.view') {
            //can't see the admin home page go back to home site page
            return Redirect::to('/')->with('error', Lang::get('backend::permissions.access_denied'));
        }
    }
});
开发者ID:hanyitom,项目名称:laravel-backend,代码行数:31,代码来源:routes.php

示例3: downloadtemplate

 public function downloadtemplate($data)
 {
     $file = public_path() . '/uploads/templates/' . $data;
     if (file_exists($file)) {
         return Response::download($file);
     } else {
         if (Sentry::hasAccess('admin')) {
             return Redirect::route('admin.template.index')->with("errorMessage", "Maaf file tidak ada.");
         } else {
             if (Sentry::hasAccess('kepala')) {
                 return Redirect::route('admin.template.index')->with("errorMessage", "Maaf file tidak ada.");
             } else {
                 if (Sentry::hasAccess('kasubbag')) {
                     return Redirect::route('kasubbag.template.index')->with("errorMessage", "Maaf file tidak ada.");
                 }
             }
         }
     }
 }
开发者ID:inseo201,项目名称:simkinerja,代码行数:19,代码来源:TemplatesController.php

示例4: switch

        switch ($rule) {
            case 'index':
            case 'show':
                $userRule = $module . '.view';
                break;
            case 'create':
            case 'store':
                $userRule = $module . '.create';
                break;
            case 'edit':
            case 'update':
                $userRule = $module . '.update';
                break;
            case 'destroy':
                $userRule = $module . '.delete';
                break;
            default:
                $userRule = Route::currentRouteName();
                break;
        }
    }
    // no access to the request page and request page not the root admin page
    if (!Sentry::hasAccess($userRule) and $userRule !== 'cpanel.view') {
        return Redirect::route('cpanel.home')->with('error', Lang::get('cpanel::permissions.access_denied'));
    } else {
        if (!Sentry::hasAccess($userRule) and $userRule === 'cpanel.view') {
            //can't see the admin home page go back to home site page
            return Redirect::to('/')->with('error', Lang::get('cpanel::permissions.access_denied'));
        }
    }
});
开发者ID:stevemo,项目名称:cpanel,代码行数:31,代码来源:routes.php


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