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


PHP Sentinel::hasAccess方法代码示例

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


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

示例1: render

 public function render()
 {
     $this->_shareData();
     if (!\Sentinel::hasAccess($this->permissions['view'])) {
         return view('eztool::no_permission');
     }
     return view('eztool::permission_editor.render');
 }
开发者ID:notegame,项目名称:eztool,代码行数:8,代码来源:PermissionEditor.php

示例2: render

 public function render()
 {
     $this->_shareData();
     if (!\Sentinel::hasAccess($this->permissions['view'])) {
         return view('eztool::no_permission');
     }
     $roles = \Sentinel::getRoleRepository()->all();
     $permissions = Permission::whereNull('parent')->orderBy('order')->get();
     return view('eztool::acl_manager.render')->with('roles', $roles)->with('permission_list', $permissions);
 }
开发者ID:notegame,项目名称:eztool,代码行数:10,代码来源:ACLManager.php

示例3: aclSentinel

 /**
  * Using Sentinel Authorization Driver
  * 
  * @param  [string] $permission
  * @param  [null] $arguments None. Sentinel doesn't support arguments
  * @package Cartalyst\Sentinel
  * @return boolean
  */
 protected function aclSentinel($permission, $arguments = NULL)
 {
     return \Sentinel::hasAccess($permission);
 }
开发者ID:SmarchSoftware,项目名称:omac,代码行数:12,代码来源:OmacTrait.php

示例4: function

| The following filters are used to verify that the user of the current
| session is logged into this application. The "basic" filter easily
| integrates HTTP Basic authentication for quick, simple checking.
|
*/
Route::filter('auth', function () {
    if (Auth::guest()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
        } else {
            return Redirect::guest('login');
        }
    }
});
Route::filter('auth.admin', function () {
    if (Sentinel::check() && !Sentinel::hasAccess('admin')) {
        return Redirect::to('account')->withErrors(['Only admins can access this page.']);
    }
});
Route::filter('auth.basic', function () {
    return Auth::basic();
});
/*
|--------------------------------------------------------------------------
| Guest Filter
|--------------------------------------------------------------------------
|
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|
开发者ID:ramigit3D,项目名称:article,代码行数:31,代码来源:filters.php

示例5: function

    if (Sentinel::guest()) {
        if (Request::ajax()) {
            return Response::make('Unauthorized', 401);
        } else {
            return Redirect::guest('login');
        }
    }
});
Route::filter('auth.admin', function () {
    if (\App::environment() != 'service' && \App::environment() != 'local') {
        return App::abort(401);
    }
    if (!Sentinel::check()) {
        return Redirect::to('admin-login');
    }
    if (!Sentinel::hasAccess('admin')) {
        return Redirect::to('admin-login')->withErrors(['Admin access required.']);
    }
});
Route::filter('auth.basic', function () {
    return Auth::basic();
});
/*
 * Check that the user has one of the permission given
 */
Route::filter('has_perm', function () {
    $permissions = array_slice(func_get_args(), 2);
    $authMgr = App::make('Giftertipster\\Service\\Auth\\AuthMgrInterface');
    if (!$authMgr->hasPermission($permissions)) {
        return Redirect::to('/login');
    }
开发者ID:ryanrobertsname,项目名称:giftertipster.com,代码行数:31,代码来源:filters.php

示例6: hasPermission

 /**
  * @param string|array $hackRoute
  * @return boolean
  */
 function hasPermission($hackRoute)
 {
     if (is_array($hackRoute)) {
         foreach ($hackRoute as $route) {
             if (hasPermission($route)) {
                 return true;
             }
         }
         return false;
     }
     $prefixes = ['admin', 'api'];
     $route = hackToRoute($hackRoute);
     $routePrefix = explode('.', $route)[0];
     if (!in_array($routePrefix, $prefixes) || Route::has($route) && (!is_null(\Sentinel::getUser()) && (\Sentinel::getUser()->is_super_admin || \Sentinel::hasAccess($hackRoute)))) {
         return true;
     }
     return false;
 }
开发者ID:erenmustafaozdal,项目名称:laravel-modules-base,代码行数:22,代码来源:helpers.php


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