mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-09 23:24:06 -08:00
f9e190eb32
Signed-off-by: snipe <snipe@snipe.net>
32 lines
712 B
PHP
32 lines
712 B
PHP
<?php
|
|
|
|
namespace App\Http\Middleware;
|
|
|
|
use Closure;
|
|
use Illuminate\Support\Facades\Gate;
|
|
|
|
class CheckPermissions
|
|
{
|
|
/**
|
|
* Handle the ACLs for permissions.
|
|
*
|
|
* The $section variable is passed via the route middleware,
|
|
* 'middleware' => [authorize:superadmin']
|
|
*
|
|
* @param \Illuminate\Http\Request $request
|
|
* @param \Closure $next
|
|
* @param string|null $section
|
|
* @return mixed
|
|
*/
|
|
public function handle($request, Closure $next, $section = null)
|
|
{
|
|
if (Gate::allows($section)) {
|
|
return $next($request);
|
|
}
|
|
|
|
return response()->view('layouts/basic', [
|
|
'content' => view('errors/403'),
|
|
]);
|
|
}
|
|
}
|