fix
This commit is contained in:
parent
00cfb2c7c3
commit
e78cf5de0e
|
@ -18,16 +18,16 @@ class CheckRole
|
||||||
abort(403, '未定义权限');
|
abort(403, '未定义权限');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (is_string($roles[$action]) && $roles[$action] == '*') {
|
||||||
|
return $next($request);
|
||||||
|
}
|
||||||
|
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
|
|
||||||
if (empty($user) || empty($user['roles'])) {
|
if (empty($user) || empty($user['roles'])) {
|
||||||
abort(403, '无权访问');
|
abort(403, '无权访问');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_string($roles[$action]) && $roles[$action] == '*') {
|
|
||||||
return $next($request);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty(array_intersect($roles[$action], $user['roles']))) {
|
if (empty(array_intersect($roles[$action], $user['roles']))) {
|
||||||
abort(403, '无权访问,请联系管理员授权');
|
abort(403, '无权访问,请联系管理员授权');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user