mirror of
https://github.com/snipe/snipe-it.git
synced 2024-12-25 13:44: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,13 +14,13 @@ 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);
|
||||
}
|
||||
|
||||
|
@ -27,5 +28,8 @@ class CheckPermissions
|
|||
'content' => view('errors/403')
|
||||
]);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue