😎新增角色时增加授权角色基础菜单集合
This commit is contained in:
parent
f5a5e716ad
commit
1ee4a276e8
@ -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<SysRole>());
|
||||
var roleId = await _sysRoleRep.AsInsertable(input.Adapt<SysRole>()).ExecuteReturnSnowflakeIdAsync();
|
||||
|
||||
// 授权角色基础菜单集合
|
||||
var menuIdList = new List<long> { 1300000000111,1300000000121, // 工作台
|
||||
1310000000161,1310000000162,1310000000163,1310000000164,1310000000165, // 个人中心
|
||||
};
|
||||
await _sysRoleMenuService.GrantRoleMenu(new RoleMenuInput() { Id = roleId, MenuIdList = menuIdList });
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -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(); // 差集
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user