From 1ee4a276e8c06afd01501cd6715996e523853f03 Mon Sep 17 00:00:00 2001 From: zuohuaijun Date: Tue, 3 Sep 2024 11:10:59 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=98=8E=E6=96=B0=E5=A2=9E=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E6=97=B6=E5=A2=9E=E5=8A=A0=E6=8E=88=E6=9D=83=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E5=9F=BA=E7=A1=80=E8=8F=9C=E5=8D=95=E9=9B=86=E5=90=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Admin.NET.Core/Service/Role/SysRoleService.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Admin.NET/Admin.NET.Core/Service/Role/SysRoleService.cs b/Admin.NET/Admin.NET.Core/Service/Role/SysRoleService.cs index c7b5e43e..e98265df 100644 --- a/Admin.NET/Admin.NET.Core/Service/Role/SysRoleService.cs +++ b/Admin.NET/Admin.NET.Core/Service/Role/SysRoleService.cs @@ -94,7 +94,13 @@ public class SysRoleService : IDynamicApiController, ITransient if (await _sysRoleRep.IsAnyAsync(u => u.Name == input.Name && u.Code == input.Code)) throw Oops.Oh(ErrorCodeEnum.D1006); - await _sysRoleRep.InsertAsync(input.Adapt()); + var roleId = await _sysRoleRep.AsInsertable(input.Adapt()).ExecuteReturnSnowflakeIdAsync(); + + // 授权角色基础菜单集合 + var menuIdList = new List { 1300000000111,1300000000121, // 工作台 + 1310000000161,1310000000162,1310000000163,1310000000164,1310000000165, // 个人中心 + }; + await _sysRoleMenuService.GrantRoleMenu(new RoleMenuInput() { Id = roleId, MenuIdList = menuIdList }); } /// @@ -311,10 +317,10 @@ public class SysRoleService : IDynamicApiController, ITransient // 当前账号所有角色集合 var roleIds = await _sysUserRoleService.GetUserRoleIdList(_userManager.UserId); - // 已有按钮权限集合 + // 已勾选按钮权限集合 apiList[0] = await GetRoleButtonList(roleIds); - // 未有按钮权限集合 + // 未勾选按钮权限集合(放到接口黑名单里面) var allButtonList = await GetButtonList(new()); apiList[1] = allButtonList.Except(apiList[0]).ToList(); // 差集