mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 05:34:06 -08:00
Switch to gate for permission check
This commit is contained in:
parent
dddb0f7267
commit
049e13e365
|
@ -5,6 +5,7 @@ namespace App\Http\Middleware;
|
|||
use Closure;
|
||||
use Config;
|
||||
use Route;
|
||||
use Gate;
|
||||
|
||||
class CheckPermissions
|
||||
{
|
||||
|
@ -13,19 +14,22 @@ class CheckPermissions
|
|||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param \Closure $next
|
||||
* @param string|null $guard
|
||||
* @param string|null $section
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle($request, Closure $next, $section = null, $guard = null)
|
||||
public function handle($request, Closure $next, $section = null)
|
||||
{
|
||||
|
||||
if (($request->user()->hasAccess($section)) || ($request->user()->isSuperUser())) {
|
||||
if (Gate::allows($section)) {
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
return response()->view('layouts/basic', [
|
||||
'content' => view('errors/403')
|
||||
'content' => view('errors/403')
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue