处理租户管理员新增权限

master
ZR20090193-陈敬勇 9 months ago
parent a3b7946625
commit 2d1451f543

@ -96,9 +96,27 @@ public class TenantService : ITenantService
IEnumerable<long> addPermissions = req.PermissionIds.AsQueryable().Except(existPermissions); IEnumerable<long> addPermissions = req.PermissionIds.AsQueryable().Except(existPermissions);
if (addPermissions.Count() > 0) if (addPermissions.Count() > 0)
{ {
var addPers = db.Queryable<SysPermission>().Filter(null, true) var addPers = db.Queryable<SysPermission>().Filter(null, true)
.Where(x => addPermissions.Contains(x.Id)).ToList(); .Where(x => addPermissions.Contains(x.Id)).ToList();
#region 处理租户管理员新增权限
var tenantRole = db.Queryable<SysRole>().Filter(null, true)
.Where(x => x.TenantId == req.TenantId && x.RoleCode == "tenantAdmin").First();
//写入租户管理员权限
var rolePerList = new List<SysRolePermission>();
foreach (var item in addPers)
{
var rolePer = item.Adapt<SysRolePermission>();
rolePer.RoleId = tenantRole.Id;
rolePer.PermissionId = item.Id;
rolePer.IsPermission = 1;
rolePerList.Add(rolePer);
}
db.Insertable(rolePerList).ExecuteCommandAsync();
#endregion 处理租户管理员新增权限
var tenantPerList = new List<SysPermissionTenant>(); var tenantPerList = new List<SysPermissionTenant>();
foreach (var item in addPers) foreach (var item in addPers)
{ {

Loading…
Cancel
Save