角色 数据授权 处理 新增组织 没对应组织权限 但是查看时确被勾选了
This commit is contained in:
parent
caec6b98c0
commit
de6518bea2
@ -471,10 +471,10 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
||||
}
|
||||
//通知权限更新
|
||||
var menuFilter = new BaseFilter();
|
||||
menuFilter.SelectField =new string[] { "ID" };
|
||||
menuFilter.SelectField = new string[] { "ID" };
|
||||
var users = this.GetEntities<T_FM_USER>(x => x.Nav_BelongRoles.Any(x => x.BELONG_ROLE_ID == role.ID), menuFilter);
|
||||
var notificationService = ServiceLocator.Instance.GetService<IFMNotificatoinService>();
|
||||
notificationService.MenusChangeNotice(users.Select(x => x.ID).ToList(),WebSocketClientTypeEnum.WEB后台);
|
||||
notificationService.MenusChangeNotice(users.Select(x => x.ID).ToList(), WebSocketClientTypeEnum.WEB后台);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
@ -1061,7 +1061,8 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
||||
{
|
||||
orgFilter.OrgId = item;
|
||||
OrgTreeData resultRule = new OrgTreeData();
|
||||
var listOrgRules = this.GetEntities<T_FM_DEPARTMENT>(null, orgFilter);
|
||||
var listOrgRules = list.Where(e => e.ORG_ID == item).ToList(); //var listOrgRules = this.GetEntities<T_FM_DEPARTMENT>(null, orgFilter);
|
||||
var orgRuleDept = listOrgRules.Select(x => x.ID);//var orgRuleDept = this.GetEntities<T_FM_DEPARTMENT>(null, orgFilter).Select(x => x.ID);
|
||||
var parentOrgRules = listOrgRules.Where(i => i.PARENT_ID == null).ToList();
|
||||
var treeDataOrgRule = new List<TreeDataModel>();
|
||||
foreach (var parentOrgRule in parentOrgRules)
|
||||
@ -1071,7 +1072,6 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
||||
treeDataOrgRule.Add(model);
|
||||
}
|
||||
resultRule.treeDataModels.AddRange(treeDataOrgRule);
|
||||
var orgRuleDept = this.GetEntities<T_FM_DEPARTMENT>(null, orgFilter).Select(x => x.ID);
|
||||
var roleOrgRules = this.GetEntities<T_FM_ROLE_DEPARTMENT>(x => x.ROLE_ID.ToString() == filter.Keyword && orgRuleDept.Contains(x.DEPARTMENT_ID), orgFilter);
|
||||
resultRule.departmentCheckedKeys.AddRange(roleOrgRules.Select(x => x.DEPARTMENT_ID));
|
||||
var orgDataRuleInfo = this.GetEntity<T_FM_ORGANIZATION>(item);
|
||||
@ -1080,6 +1080,61 @@ namespace APT.FM.WebApi.Controllers.Api.FM
|
||||
result.Add(resultRule);
|
||||
}
|
||||
}
|
||||
|
||||
foreach (var item in result)
|
||||
{
|
||||
if (item.departmentCheckedKeys != null && item.departmentCheckedKeys.Count() > 0)
|
||||
{
|
||||
T_FM_DEPARTMENT depCheck = null;
|
||||
IEnumerable<Guid> listDepCheckSubID = null;
|
||||
IEnumerable<Guid> listCheckCheck = null;
|
||||
List<Guid> listGuidDel = new List<Guid>();
|
||||
foreach (var itemDepID in item.departmentCheckedKeys)
|
||||
{
|
||||
depCheck = list.FirstOrDefault(e => e.ID == itemDepID);
|
||||
if (depCheck != null)
|
||||
{
|
||||
listDepCheckSubID = list.Where(e => e.PARENT_ID.HasValue && e.PARENT_ID.Value == depCheck.ID).Select(e => e.ID);
|
||||
if (listDepCheckSubID != null && listDepCheckSubID.Count() > 0)
|
||||
{
|
||||
listCheckCheck = item.departmentCheckedKeys.Where(e => listDepCheckSubID.Contains(e));
|
||||
if (listCheckCheck == null || listCheckCheck.Count() != listDepCheckSubID.Count())
|
||||
{
|
||||
if (!listGuidDel.Contains(itemDepID))
|
||||
{
|
||||
listGuidDel.Add(itemDepID);
|
||||
|
||||
while (depCheck.PARENT_ID.HasValue)
|
||||
{
|
||||
if (!listGuidDel.Contains(depCheck.PARENT_ID.Value))
|
||||
{
|
||||
listGuidDel.Add(depCheck.PARENT_ID.Value);
|
||||
}
|
||||
depCheck = list.FirstOrDefault(e => e.ID == depCheck.PARENT_ID.Value);
|
||||
if (depCheck.PARENT_ID.HasValue && !listGuidDel.Contains(depCheck.PARENT_ID.Value))
|
||||
{
|
||||
listGuidDel.Add(depCheck.PARENT_ID.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (listGuidDel.Count > 0)
|
||||
{
|
||||
int lenth = item.departmentCheckedKeys.Count;
|
||||
for (int i = lenth - 1; i > -1; i--)
|
||||
{
|
||||
if (listGuidDel.Contains(item.departmentCheckedKeys[i]))
|
||||
{
|
||||
item.departmentCheckedKeys.Remove(item.departmentCheckedKeys[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user