當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。