作者 lyh

gx

@@ -24,21 +24,14 @@ class LoginAuthMiddleware @@ -24,21 +24,14 @@ class LoginAuthMiddleware
24 { 24 {
25 $manage = LoginLogic::manage(); 25 $manage = LoginLogic::manage();
26 if (!$manage) { 26 if (!$manage) {
27 - return response(['status'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户未登录']); 27 + return response(['code'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户未登录']);
28 } 28 }
29 //权限 29 //权限
30 if($manage['id'] != Manage::ADMINISTRATOR_ID){ //排除超级管理员 30 if($manage['id'] != Manage::ADMINISTRATOR_ID){ //排除超级管理员
31 - $route = Route::getCurrentRoute()->getName();  
32 - if(!Str::endsWith($route, '.white')){ //排除白名单路由  
33 - $routes = Group::getRouteByGroupId($manage['gid']);  
34 - var_dump($routes);  
35 - die();  
36 - if(!in_array($route, $routes)){  
37 - return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'当前用户没有权限']);  
38 - } 31 + if($manage['status'] != 1){
  32 + return response(['code'=> Code::USER_LOGIN_ERROE,'msg'=>'当前用户被禁用']);
39 } 33 }
40 } 34 }
41 -  
42 return $next($request); 35 return $next($request);
43 } 36 }
44 } 37 }
@@ -30,10 +30,10 @@ class LoginAuthMiddleware @@ -30,10 +30,10 @@ class LoginAuthMiddleware
30 return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'当前用户未登录']); 30 return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'当前用户未登录']);
31 } 31 }
32 // 设置数据信息 32 // 设置数据信息
33 -// $project = ProjectServer::useProject($info['project_id']);  
34 -// if(empty($project)){  
35 -// return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'数据库未配置']);  
36 -// } 33 + $project = ProjectServer::useProject($info['project_id']);
  34 + if(empty($project)){
  35 + return response(['code'=>Code::USER_LOGIN_ERROE,'msg'=>'数据库未配置']);
  36 + }
37 //操作权限设置 37 //操作权限设置
38 $projectRoleModel = new ProjectRoleModel(); 38 $projectRoleModel = new ProjectRoleModel();
39 $role_info = $projectRoleModel->read(['id'=>$info['role_id']]); 39 $role_info = $projectRoleModel->read(['id'=>$info['role_id']]);
@@ -36,8 +36,6 @@ class Group extends Base @@ -36,8 +36,6 @@ class Group extends Base
36 return []; 36 return [];
37 } 37 }
38 $routes = Menu::where(['status' => Menu::STATUS_NORMAL])->whereIn('id', $group->rights)->pluck('route_name')->toArray(); 38 $routes = Menu::where(['status' => Menu::STATUS_NORMAL])->whereIn('id', $group->rights)->pluck('route_name')->toArray();
39 - var_dump($routes);  
40 - die();  
41 return array_filter($routes); 39 return array_filter($routes);
42 } 40 }
43 41