bug fix
This commit is contained in:
parent
b99be29a9d
commit
26714dbc63
|
@ -15,13 +15,12 @@ class CheckRole
|
||||||
$roles = $controller::Privileges;
|
$roles = $controller::Privileges;
|
||||||
|
|
||||||
if (empty($roles) || empty($roles[$action])) {
|
if (empty($roles) || empty($roles[$action])) {
|
||||||
api_abort(403, '未定义权限');
|
abort(403, '未定义权限');
|
||||||
}
|
}
|
||||||
|
|
||||||
$user = $request->user();
|
$user = $request->user();
|
||||||
|
if (empty(array_intersect($roles[$action],$user['roles']))) {
|
||||||
if (!$user->hasRoles($roles[$action])) {
|
abort(403, '无权访问');
|
||||||
api_abort(403, '无权访问');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $next($request);
|
return $next($request);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user