diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs index 1aec3327..4accc1eb 100644 --- a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs +++ b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/Controllers/AccountController.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; +using Yi.Framework.Common.Const; using Yi.Framework.Common.Enum; using Yi.Framework.Common.Helper; using Yi.Framework.Common.Models; @@ -135,9 +136,15 @@ namespace Yi.Framework.ApiMicroservice.Controllers { var userId = HttpContext.GetUserIdInfo(); var data = await _iUserService.GetUserAllInfo(userId); + var menus = data.Menus.ToList(); + //为超级管理员直接给全部路由 + if (SystemConst.Admin.Equals(data.User.UserName)) + { + menus = await _iUserService._repository.ChangeRepository>().GetListAsync(); + } //将后端菜单转换成前端路由,组件级别需要过滤 - List routers = MenuEntity.RouterBuild(data.Menus.ToList()); + List routers = MenuEntity.RouterBuild(menus); return Result.Success().SetData(routers); } diff --git a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db index 467083e3..f907f23a 100644 Binary files a/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db and b/Yi.Framework.Net6/Yi.Framework.ApiMicroservice/yi-sqlsugar-dev.db differ diff --git a/Yi.Framework.Net6/Yi.Framework.Common/Const/SystemConst.cs b/Yi.Framework.Net6/Yi.Framework.Common/Const/SystemConst.cs new file mode 100644 index 00000000..c6c7e2d4 --- /dev/null +++ b/Yi.Framework.Net6/Yi.Framework.Common/Const/SystemConst.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Yi.Framework.Common.Const +{ + public class SystemConst + { + public const string Admin = "cc"; + public const string AdminRolesCode = "admin"; + public const string AdminPermissionCode = "*:*:*"; + } +} diff --git a/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs b/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs index 2ae0bd44..89751d33 100644 --- a/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs +++ b/Yi.Framework.Net6/Yi.Framework.Service/UserService.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; +using Yi.Framework.Common.Const; using Yi.Framework.Common.Enum; using Yi.Framework.Common.Helper; using Yi.Framework.Common.Models; @@ -53,7 +54,7 @@ namespace Yi.Framework.Service if (await Exist(userName, o => user = o)) { userAction.Invoke(user); - if (user.Password == Common.Helper.MD5Helper.SHA2Encode(password, user.Salt)) + if (user.Password ==MD5Helper.SHA2Encode(password, user.Salt)) { return true; } @@ -149,6 +150,7 @@ namespace Yi.Framework.Service public async Task GetUserAllInfo(long userId) { + var userRoleMenu = new UserRoleMenuDto(); //首先获取到该用户全部信息,导航到角色、菜单,(菜单需要去重,完全交给Set来处理即可) @@ -160,6 +162,18 @@ namespace Yi.Framework.Service } user.Password = null; user.Salt = null; + + //超级管理员特殊处理 + if (SystemConst.Admin.Equals(user.UserName)) + { + userRoleMenu.User = user; + userRoleMenu.RoleCodes.Add(SystemConst.AdminRolesCode); + userRoleMenu.PermissionCodes.Add(SystemConst.AdminPermissionCode); + return userRoleMenu; + } + + + //得到角色集合 var roleList = user.Roles; diff --git a/Yi.Vue3.X.RuoYi/.env.development b/Yi.Vue3.X.RuoYi/.env.development index 59a05506..1215ddfd 100644 --- a/Yi.Vue3.X.RuoYi/.env.development +++ b/Yi.Vue3.X.RuoYi/.env.development @@ -1,5 +1,5 @@ # 页面标题 -VITE_APP_TITLE = 若依管理系统 +VITE_APP_TITLE = 意框架管理系统 # 开发环境配置 VITE_APP_ENV = 'development' diff --git a/Yi.Vue3.X.RuoYi/.env.production b/Yi.Vue3.X.RuoYi/.env.production index cbabf899..a3c73ff2 100644 --- a/Yi.Vue3.X.RuoYi/.env.production +++ b/Yi.Vue3.X.RuoYi/.env.production @@ -1,10 +1,10 @@ # 页面标题 -VITE_APP_TITLE = 若依管理系统 +VITE_APP_TITLE = 意框架管理系统 # 生产环境配置 VITE_APP_ENV = 'production' -# 若依管理系统/生产环境 +# 意框架管理系统/生产环境 VITE_APP_BASE_API = '/prod-api' # 是否在打包时开启压缩,支持 gzip 和 brotli diff --git a/Yi.Vue3.X.RuoYi/index.html b/Yi.Vue3.X.RuoYi/index.html index d20d02e5..12948d99 100644 --- a/Yi.Vue3.X.RuoYi/index.html +++ b/Yi.Vue3.X.RuoYi/index.html @@ -7,7 +7,7 @@ - 若依管理系统 + Yi意框架-ruoyi管理系统