|
...
|
...
|
@@ -33,18 +33,20 @@ class LoginAuthMiddleware |
|
|
|
return response(['code'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户被禁用']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$groupInfo = $this->getGroup($manage);
|
|
|
|
if($groupInfo['status'] != 1){
|
|
|
|
return response(['code'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户角色被禁用']);
|
|
|
|
}
|
|
|
|
//获取当前操作的路由name
|
|
|
|
$action = Route::currentRouteName();
|
|
|
|
//TODO::操作权限
|
|
|
|
$menuModel = new Menu();
|
|
|
|
$menu_id = $menuModel->read(['route_name'=>$action],['id']);
|
|
|
|
if($menu_id !== false){
|
|
|
|
if(in_array($menu_id['id'],$groupInfo['rights']) === false){
|
|
|
|
return response(['code'=>Code::USER_PERMISSION_ERROE,'msg'=>'当前用户没有权限']);
|
|
|
|
if($manage['gid'] != 0){
|
|
|
|
$groupInfo = $this->getGroup($manage);
|
|
|
|
if($groupInfo['status'] != 1){
|
|
|
|
return response(['code'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户角色被禁用']);
|
|
|
|
}
|
|
|
|
//获取当前操作的路由name
|
|
|
|
$action = Route::currentRouteName();
|
|
|
|
//TODO::操作权限
|
|
|
|
$menuModel = new Menu();
|
|
|
|
$menu_id = $menuModel->read(['route_name'=>$action],['id']);
|
|
|
|
if($menu_id !== false){
|
|
|
|
if(in_array($menu_id['id'],$groupInfo['rights']) === false){
|
|
|
|
return response(['code'=>Code::USER_PERMISSION_ERROE,'msg'=>'当前用户没有权限']);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $next($request);
|
...
|
...
|
|