区分不同权限错误
This commit is contained in:
parent
26714dbc63
commit
4a6ddf2e00
|
@ -19,10 +19,15 @@ class CheckRole
|
|||
}
|
||||
|
||||
$user = $request->user();
|
||||
if (empty(array_intersect($roles[$action],$user['roles']))) {
|
||||
|
||||
if( empty($user) || empty($user['roles']) ){
|
||||
abort(403, '无权访问');
|
||||
}
|
||||
|
||||
if (empty(array_intersect($roles[$action],$user['roles']))) {
|
||||
abort(403, '无权访问,请联系管理员授权');
|
||||
}
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user