本文整理汇总了PHP中Entrust::routeNeedsPermission方法的典型用法代码示例。如果您正苦于以下问题:PHP Entrust::routeNeedsPermission方法的具体用法?PHP Entrust::routeNeedsPermission怎么用?PHP Entrust::routeNeedsPermission使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Entrust
的用法示例。
在下文中一共展示了Entrust::routeNeedsPermission方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
});
/*
|--------------------------------------------------------------------------
| Role Permissions
|--------------------------------------------------------------------------
|
| Access filters based on roles.
|
*/
// Check for role on all admin routes
Entrust::routeNeedsRole('admin*', array('admin'), Redirect::to('/'));
// Check for permissions on admin actions
Entrust::routeNeedsPermission('admin/blogs*', 'manage_blogs', Redirect::to('/admin'));
Entrust::routeNeedsPermission('admin/comments*', 'manage_comments', Redirect::to('/admin'));
Entrust::routeNeedsPermission('admin/users*', 'manage_users', Redirect::to('/admin'));
Entrust::routeNeedsPermission('admin/roles*', 'manage_roles', Redirect::to('/admin'));
/*
|--------------------------------------------------------------------------
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
if (Session::getToken() !== Input::get('csrf_token') && Session::getToken() !== Input::get('_token')) {
throw new Illuminate\Session\TokenMismatchException();
}
});
示例2: function
Route::filter('auth.basic', function () {
return Auth::basic();
});
Route::filter('guest', function () {
if (Auth::check()) {
return Redirect::to('user/login/');
}
});
Entrust::routeNeedsRole('admin*', array('admin'), Redirect::to('/nopermission'));
Entrust::routeNeedsPermission('admin/slugs*', 'manage_blogs', Redirect::to('/admin'));
Entrust::routeNeedsPermission('admin/comments*', 'manage_comments', Redirect::to('/admin'));
Entrust::routeNeedsPermission('admin/users*', 'manage_users', Redirect::to('/admin'));
Entrust::routeNeedsPermission('admin/roles*', 'manage_roles', Redirect::to('/admin'));
Entrust::routeNeedsPermission('admin/settings*', 'manage_settings', Redirect::to('/admin'));
Entrust::routeNeedsPermission('admin/search*', 'site_search', Redirect::to('/admin'));
Entrust::routeNeedsPermission('admin/todos*', 'manage_todos', Redirect::to('/admin'));
Route::filter('csrf', function () {
if (Session::getToken() != Input::get('csrf_token') && Session::getToken() != Input::get('_token')) {
return Redirect::to('invalidtoken');
}
});
Route::filter('detectLang', function ($route, $request, $lang = 'auto') {
if ($lang != "auto" && in_array($lang, Config::get('app.available_language'))) {
Config::set('app.locale', $lang);
} else {
$browser_lang = !empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? strtok(strip_tags($_SERVER['HTTP_ACCEPT_LANGUAGE']), ',') : '';
$browser_lang = substr($browser_lang, 0, 2);
$userLang = in_array($browser_lang, Config::get('app.available_language')) ? $browser_lang : Config::get('app.locale');
Config::set('app.locale', $userLang);
App::setLocale($userLang);
}
示例3: function
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
if (Session::token() != Input::get('_token')) {
throw new Illuminate\Session\TokenMismatchException();
}
});
// Permission filter for sales module
Entrust::routeNeedsPermission('sales*', ['view_sales']);
// Permission filter for customers
Entrust::routeNeedsPermission('customer*', ['manage_customers']);
Entrust::routeNeedsRole('admin*', ['Admin']);
Route::filter('users.manage', function () {
if (!Entrust::can('manage_users')) {
return Response::make('Unauthorized', 403);
}
});
Route::filter('request.create', function () {
if (Entrust::can('direct_award')) {
return;
}
if (!Entrust::can('create_quotations')) {
return Redirect::route('sales.index')->with('message', 'You do not have permission to view create RFQs.')->with('alert-class', 'danger');
}
});
Route::filter('request.view', function ($route) {
示例4: function
});
# Forum Management
$router->group(['prefix' => 'forum'], function () use($router) {
$router->get('/', ['as' => 'admin.forum.get.index', 'uses' => 'AdminForumsController@index']);
$router->get('/create', ['as' => 'admin.forum.get.create.category', 'uses' => 'AdminForumsController@showCreateCategory']);
$router->post('/create', ['as' => 'admin.forum.post.create.category', 'uses' => 'AdminForumsController@storeCategory']);
$router->get('/{category}/edit', ['as' => 'admin.forum.get.edit.category', 'uses' => 'AdminForumsController@showEditCategory']);
$router->post('/{category}/edit', ['as' => 'admin.forum.post.edit.category', 'uses' => 'AdminForumsController@editCategory']);
$router->get('/channel/{channel}/edit', ['as' => 'admin.forum.get.edit.channel', 'uses' => 'AdminForumsController@showEditChannel']);
$router->post('/channel/{channel}/edit', ['as' => 'admin.forum.post.edit.channel', 'uses' => 'AdminForumsController@editChannel']);
$router->get('/categories/{category}/new-channel', ['as' => 'admin.forum.get.category.create-channel', 'uses' => 'AdminForumsController@showCreateChannel']);
$router->post('/categories/{category}/new-channel', ['as' => 'admin.forum.post.category.create-channel', 'uses' => 'AdminForumsController@createChannel']);
$router->group(['prefix' => 'permissions'], function () use($router) {
$router->get('/categories', ['as' => 'admin.forum.get.permissions.categories.index', 'uses' => 'CategoryPermissionManagerController@index']);
$router->get('/channels', ['as' => 'admin.forum.get.permissions.channels.index', 'uses' => 'ChannelPermissionManagerController@index']);
$router->get('/channels/{channel}/edit', ['as' => 'admin.forum.get.permissions.channels.edit', 'uses' => 'ChannelPermissionManagerController@edit']);
$router->post('/channels/{channel}/edit', ['as' => 'admin.forum.get.permissions.channels.edit', 'uses' => 'ChannelPermissionManagerController@update']);
$router->get('/categories/{category}/edit', ['as' => 'admin.forum.get.permissions.category.edit', 'uses' => 'CategoryPermissionManagerController@edit']);
$router->post('/categories/{category}/edit', ['as' => 'admin.forum.post.permissions.category.edit', 'uses' => 'CategoryPermissionManagerController@update']);
});
$router->post('/channel/{channel}/delete', ['as' => 'admin.forum.post.delete.channel', 'uses' => 'AdminForumsController@deleteChannel']);
$router->post('/category/{category}/delete', ['as' => 'admin.forum.post.delete.category', 'uses' => 'AdminForumsController@deleteCategory']);
});
# Reports
$router->group(['prefix' => 'reports'], function () use($router) {
$router->get('/', ['as' => 'reports.index', 'uses' => 'AdminReportsController@index']);
$router->get('/{report}', ['as' => 'reports.view', 'uses' => 'AdminReportsController@show']);
});
Entrust::routeNeedsPermission('admin*', 'accessAdminPanel');
});
});
示例5: function
});
/*
|--------------------------------------------------------------------------
| Authentication Filters
|--------------------------------------------------------------------------
|
| 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.
|
*/
Entrust::routeNeedsPermission('admin/customer*', 'manage_customers', Redirect::to('admin'));
Entrust::routeNeedsPermission('admin/followup*', 'manage_customers', Redirect::to('admin'));
Entrust::routeNeedsPermission('admin/penjualan*', 'manage_penjualans', Redirect::to('admin'));
Entrust::routeNeedsPermission('admin/ekspedisi*', 'manage_ekspedisi', Redirect::to('admin'));
Entrust::routeNeedsPermission('admin/outlet*', 'manage_outlet', Redirect::to('admin'));
Route::filter('auth', function () {
if (Auth::guest()) {
if (Request::ajax()) {
return Response::make('Unauthorized', 401);
} else {
return Redirect::guest('store/users/login')->with('message', 'Anda Harus Login terlebih dahulu');
}
}
});
Route::filter('auth.basic', function () {
return Auth::basic();
});
Route::filter('admin', function () {
if (Auth::guest()) {
return Redirect::to('store');
示例6: function
|--------------------------------------------------------------------------
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
if (Session::token() != Input::get('_token')) {
throw new Illuminate\Session\TokenMismatchException();
}
});
/*
|--------------------------------------------------------------------------
| Roles & Permissions Filters
|--------------------------------------------------------------------------
|
*/
Entrust::routeNeedsRole('admin', ['Administrator', 'Users Manager', 'Premium Author', 'Author', 'Eraser'], Redirect::to('/'), false);
Entrust::routeNeedsPermission('admin/xcasts*', ['manage_premium_casts', 'manage_free_casts', 'delete_casts'], Redirect::to('admin'), false);
Entrust::routeNeedsPermission('admin/series*', ['manage_series', 'delete_series'], Redirect::to('admin'), false);
Entrust::routeNeedsPermission('admin/users*', ['manage_users', 'delete_users'], Redirect::to('admin'), false);
Route::filter('can_manage_premium_casts', function () {
if (Xcast::find(Route::input('xcasts'))->levels > 0) {
if (!Entrust::can('manage_premium_casts') && !Entrust::can('delete_casts')) {
return Redirect::to('admin');
}
}
});
示例7:
/*=======================================
= AdKats Settings =
=======================================*/
Entrust::routeNeedsPermission('admin/adkats/settings', 'admin.adkats.settings.edit');
Entrust::routeNeedsPermission('admin/adkats/settings/*', 'admin.adkats.settings.edit');
/*==================================
= Site Users =
==================================*/
Entrust::routeNeedsPermission('admin/site/users', 'admin.site.users');
Entrust::routeNeedsPermission('admin/site/users/*', 'admin.site.users');
/*==================================
= Site Roles =
==================================*/
Entrust::routeNeedsPermission('admin/site/roles', 'admin.site.roles');
Entrust::routeNeedsPermission('admin/site/roles/*', 'admin.site.roles');
/*=====================================
= Site Settings =
=====================================*/
Entrust::routeNeedsPermission('admin/site/settings', 'admin.site.settings.site');
Entrust::routeNeedsPermission('admin/updater', 'admin.site.settings.site');
/*============================================
= Site Server Settings =
============================================*/
Entrust::routeNeedsPermission('admin/site/servers', 'admin.site.settings.server');
Entrust::routeNeedsPermission('admin/site/servers/*', 'admin.site.settings.server');
/*================================================
= Require the Menu Builder =
================================================*/
if (!file_exists($app['path.base'] . '/app/bfacp/setup.php')) {
require $app['path.base'] . '/app/menu.php';
}
示例8: 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');
}
}
});
// Only admin permission can enter admin panel
Entrust::routeNeedsPermission('admin/*', 'manage_contents');
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.
|
*/
Route::filter('guest', function () {
if (Auth::check()) {
示例9:
Route::resource('timeclock', 'TimeClockController');
Route::resource('user', 'UserTimeController');
});
//AJAX Request Pages
Route::post('/api/clockin', 'TimeClockController@clockIn');
Route::post('/api/clockout', 'TimeClockController@clockOut');
Route::get('/api/getClockedStatus', 'TimeClockController@getClockedStatus');
Route::get('/api/employee-list', 'EmployeeListController@getList');
Route::get('/api/getDepartments', 'TasksController@getDepartments');
Route::get('/api/getAllDepartments', 'TasksController@getAllDepartments');
Route::post('/api/postDepartments', 'TasksController@postDepartments');
Route::get('/api/getTasks/', 'TasksController@getTasks');
Route::get('/api/task-records', 'TasksController@getTaskRecords');
Route::any('/api/edit-task', 'TasksController@editTask');
Route::any('/api/delete-task', 'TasksController@deleteTask');
Route::any('/api/approve-task', 'TasksController@approveTask');
Route::get('/api/it-topics', 'ITController@getItTopics');
Route::get('/api/tasks-wdepartments', 'TasksController@getDepartmentsWTasks');
Route::get('/api/user-status', 'UserController@getEmployeeStatus');
Route::get('/api/user-departments', 'UserController@getUsersDepartments');
Route::get('/api/UserDepartments', 'TasksController@getUserDepartments');
Route::any('/api/log-user', 'UserController@logUser');
Route::get('/api/pending-tasks', 'TasksController@getPendingTaskRecords');
Route::get('/api/recently-completed', 'TasksController@getRecentlyCompleted');
// Route Permissions
Entrust::routeNeedsRole('admin/*', 'admin', Redirect::to('/'));
Entrust::routeNeedsRole('it-request-form/add-topics', 'admin', Redirect::to('/'));
Entrust::routeNeedsRole('user/edit*', 'admin', Redirect::to('/'));
Entrust::routeNeedsPermission('tasks/create', 'create-task', Redirect::to('/'));
Entrust::routeNeedsPermission('tasks/view-all-tasks', 'view-tasks', Redirect::to('/'));
示例10: array
|--------------------------------------------------------------------------
| Role Permissions
|--------------------------------------------------------------------------
|
| Access filters based on roles.
|
*/
// Check for role on all admin routes
Entrust::routeNeedsRole('admin*', array('admin'), Redirect::to('/nopermission'));
// Check for permissions on admin actions
Entrust::routeNeedsPermission('admin/slugs*', 'manage_blogs', Redirect::to('/admin'));
Entrust::routeNeedsPermission('admin/comments*', 'manage_comments', Redirect::to('/admin'));
Entrust::routeNeedsPermission('admin/users*', 'manage_users', Redirect::to('/admin'));
Entrust::routeNeedsPermission('admin/roles*', 'manage_roles', Redirect::to('/admin'));
Entrust::routeNeedsPermission('admin/settings*', 'manage_settings', Redirect::to('/admin'));
Entrust::routeNeedsPermission('admin/maps*', 'manage_settings', Redirect::to('/admin'));
/*
|--------------------------------------------------------------------------
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
if (Session::getToken() != Input::get('csrf_token') && Session::getToken() != Input::get('_token')) {
return Redirect::to('invalidtoken');
}
});
示例11:
/*==================================
= Site Users =
==================================*/
Entrust::routeNeedsPermission('admin/site/users', 'admin.site.users');
Entrust::routeNeedsPermission('admin/site/users/*', 'admin.site.users');
/*==================================
= Site Roles =
==================================*/
Entrust::routeNeedsPermission('admin/site/roles', 'admin.site.roles');
Entrust::routeNeedsPermission('admin/site/roles/*', 'admin.site.roles');
/*=====================================
= Site Settings =
=====================================*/
Entrust::routeNeedsPermission('admin/site/settings', 'admin.site.settings.site');
Entrust::routeNeedsPermission('admin/updater', 'admin.site.settings.site');
/*============================================
= Site Server Settings =
============================================*/
Entrust::routeNeedsPermission('admin/site/servers', 'admin.site.settings.server');
Entrust::routeNeedsPermission('admin/site/servers/*', 'admin.site.settings.server');
/*========================================
= Site System Logs =
========================================*/
Entrust::routeNeedsPermission(Config::get('logviewer::base_url'), 'admin.site.system.logs');
Entrust::routeNeedsPermission(Config::get('logviewer::base_url') . '/*', 'admin.site.system.logs');
/*================================================
= Require the Menu Builder =
================================================*/
if (!file_exists($app['path.base'] . '/app/bfacp/setup.php')) {
require $app['path.base'] . '/app/menu.php';
}
示例12: function
<?php
# News management
$router->group(['prefix' => 'news', 'middleware' => ['bancheck', 'update_last_activity']], function () use($router) {
$router->get('/', ['as' => 'news.index', 'uses' => 'News\\NewsController@showIndex']);
$router->get('/create', ['as' => 'news.get.create', 'uses' => 'News\\NewsController@showCreate']);
$router->post('/create', ['as' => 'news.post.create', 'uses' => 'News\\NewsController@store']);
$router->get('/{news}', ['as' => 'news.show', 'uses' => 'News\\NewsController@showPost']);
Entrust::routeNeedsPermission('news/create', 'create_news_posts');
});
示例13: redirect
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
// Permission route
Entrust::routeNeedsPermission('backend/*', ['backend'], redirect(''));
//Route::get('test', function() {
// $url = 'http://leesummithighschool.rschoolteams.com/';
// $apaya = [];
// $client = new Goutte\Client();
// $crawler = $client->request('GET', $url);
// $client->getClient()->setDefaultOption('config/curl/' . CURLOPT_TIMEOUT, 60);
// $activities = $crawler->filter('ul[class="dropdown-menu sub-menu"] > li[class="dropdown"]')->each(function ($node) {
// $act = $node->filter('a[class="dropdown-toggle"]')->text();
// $type = $node->filter('ul li a')->each(function($child) {
// $url = 'http://fargosouthhighschool.rschoolteams.com/';
// return ['sub' => trim($child->text()), 'url' => $url . $child->attr('href')];
// });
// $data[$act] = $type;
// return [$act => $type];
// });
// foreach ($activities as $key => $val) {
// foreach ($val as $taek => $kamp) {
示例14: array
// this is to make the Redirect::intendeed work later on.
return Redirect::guest('user/login');
}
});
# Index Page - Last route, no matches
Route::get('/', array('before' => 'detectLang', 'uses' => 'UserController@getLogin'));
Route::get('/create', array('before' => 'detectLang', 'uses' => 'UserController@getCreate'));
Route::get('/forgot', array('before' => 'detectLang', 'uses' => 'UserController@getForgot'));
Route::get('/proba', array('before' => 'detectLang', 'uses' => 'UserController@getError'));
Route::group(array('after' => 'auth'), function () {
Route::get('/dashboard', array('uses' => 'HomeController@home'));
/*Livrabile*/
Route::get('/livrabile', array('uses' => 'LivrabileController@getLivrabile'));
Route::get('/livrabile_factura/{id}', array('as' => 'livrabile_factura', 'uses' => 'LivrabileController@getLivrabileFactura'));
Route::post('/salveaza_departamente_utilizator', array('as' => 'salveaza_departamente_utilizator', 'uses' => 'AdminDepartamenteController@SalveazaAdaugaDepartamente'));
Route::get('/logins', array('uses' => 'LoginsController@getLogins'));
/*Utils*/
Route::get('/genereaza_segmentare', array('uses' => 'UtilController@genereazaSegmentareGeografica'));
});
Entrust::routeNeedsPermission('admin/users*', 'manage_users', Response::view('error.403', [], 403));
Entrust::routeNeedsPermission('admin/roles*', 'manage_roles', Response::view('error.403', [], 403));
Entrust::routeNeedsPermission('factur*', 'manage_finance', Response::view('error.403', [], 403));
Entrust::routeNeedsPermission('detalii_factura*', 'manage_finance', Response::view('error.403', [], 403));
Entrust::routeNeedsPermission('livrabile_nefacturate*', 'manage_finance', Response::view('error.403', [], 403));
Entrust::routeNeedsPermission('incasar*', 'manage_finance', Response::view('error.403', [], 403));
Entrust::routeNeedsPermission('registru_intrare*', 'manage_registru_intrare', Response::view('error.403', [], 403));
Entrust::routeNeedsPermission('registru_iesire*', 'manage_registru_iesire', Response::view('error.403', [], 403));
Entrust::routeNeedsPermission('investitie_por_axa12_list', 'list_por_axa12', Response::view('error.403', [], 403));
Entrust::routeNeedsPermission('investitie_por_axa12_edit', 'edit_por_axa12', Response::view('error.403', [], 403));
Entrust::routeNeedsPermission('investitie_por_axa12_add', 'add_por_axa12', Response::view('error.403', [], 403));
示例15: function
Route::post('auth/login', 'Auth\\AuthController@postLogin');
Route::get('auth/logout', 'Auth\\AuthController@getLogout');
// Admin routes
Route::group(['middleware' => 'auth'], function () {
// only users with roles that have the 'edit-users' permission will be able to access any route within admin/post
Entrust::routeNeedsPermission('admin/*', 'edit-users', Redirect::to('errors/403'));
Route::get('admin/create_user', 'Admin\\AdminController@getCreateUser');
Route::post('admin/create_user', 'Admin\\AdminController@postCreateUser');
Route::get('admin/delete_user/{id}', 'Admin\\AdminController@getDeleteUser');
Route::post('admin/delete_user/{id}', 'Admin\\AdminController@postDeleteUser');
Route::get('admin/update_user/{id}', 'Admin\\AdminController@getUpdateUser');
Route::post('admin/update_user/{id}', 'Admin\\AdminController@postUpdateUser');
});
// Contacts routes
Route::group(['middleware' => 'auth'], function () {
// only users with roles that have the 'edit-users' permission will be able to access any route within admin/post
Entrust::routeNeedsPermission('contacts/*', 'edit-contacts', Redirect::to('errors/403'));
Route::get('contacts/create_contact', 'Contacts\\ContactsController@getCreateContact');
Route::post('contacts/create_contact', 'Contacts\\ContactsController@postCreateContact');
Route::get('contacts/delete_contact/{id}', 'Contacts\\ContactsController@getDeleteContact');
Route::post('contacts/delete_contact/{id}', 'Contacts\\ContactsController@postDeleteContact');
Route::get('contacts/import_contacts', 'Contacts\\ImportController@getImportContacts');
Route::post('contacts/import_contacts', 'Contacts\\ImportController@postImportContacts');
});
// errors
Route::get('/errors/503', function () {
return view('errors/503');
});
Route::get('/errors/403', function () {
return view('errors/403');
});