作者 lyh

gx

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