This commit is contained in:
候学杰 2018-02-09 17:01:48 +08:00
parent b99be29a9d
commit 26714dbc63

View File

@ -15,16 +15,15 @@ class CheckRole
$roles = $controller::Privileges;
if (empty($roles) || empty($roles[$action])) {
api_abort(403, '未定义权限');
abort(403, '未定义权限');
}
$user = $request->user();
if (!$user->hasRoles($roles[$action])) {
api_abort(403, '无权访问');
if (empty(array_intersect($roles[$action],$user['roles']))) {
abort(403, '无权访问');
}
return $next($request);
}
}
}