修改权限

This commit is contained in:
yanwenwu 2020-01-25 11:20:27 +08:00
parent e61b61a220
commit 07442c8292

View File

@ -24,10 +24,6 @@ class PermissionsMiddleware
*/ */
public function handle(Request $request, \Closure $next) public function handle(Request $request, \Closure $next)
{ {
// 超级管理员
if ($request->user()->id === config('catch.permissions.super_admin_id')) {
return $next($request);
}
// Get 请求 // Get 请求
if ($request->isGet() && config('catch.permissions.is_allow_get')) { if ($request->isGet() && config('catch.permissions.is_allow_get')) {
return $next($request); return $next($request);
@ -49,7 +45,10 @@ class PermissionsMiddleware
if (!$user) { if (!$user) {
throw new PermissionForbiddenException('Login is invalid', Code::LOST_LOGIN); throw new PermissionForbiddenException('Login is invalid', Code::LOST_LOGIN);
} }
// 超级管理员
if ($request->user()->id === config('catch.permissions.super_admin_id')) {
return $next($request);
}
// toad // toad
$permission = $this->getPermission($module, $controller, $action); $permission = $this->getPermission($module, $controller, $action);
if (!$permission || !in_array($permission->id, Cache::get(CatchCacheKeys::USER_PERMISSIONS . $user->id))) { if (!$permission || !in_array($permission->id, Cache::get(CatchCacheKeys::USER_PERMISSIONS . $user->id))) {