修改权限
This commit is contained in:
parent
e61b61a220
commit
07442c8292
@ -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))) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user