fix 下级部门用户不应该访问到上级树节点
This commit is contained in:
@@ -83,17 +83,18 @@ namespace Ewide.Core.Service
|
|||||||
if (dataScopes.Count < 1)
|
if (dataScopes.Count < 1)
|
||||||
return dataScopeList;
|
return dataScopeList;
|
||||||
|
|
||||||
// 此处获取所有的上级节点,用于构造完整树
|
// 不需要去查找上级节点
|
||||||
dataScopes.ForEach(u =>
|
|
||||||
{
|
|
||||||
var sysOrg = _sysOrgRep.DetachedEntities.FirstOrDefault(c => c.Id == u);
|
|
||||||
var parentAndChildIdListWithSelf = sysOrg.Pids.TrimEnd(',').Replace("[", "").Replace("]", "")
|
|
||||||
.Split(",").ToList();
|
|
||||||
dataScopeList.AddRange(parentAndChildIdListWithSelf);
|
|
||||||
|
|
||||||
// 添加本级(不知道为什么框架在这里排除了本级)
|
// 此处获取所有的上级节点,用于构造完整树
|
||||||
dataScopeList.Add(u);
|
//dataScopes.ForEach(u =>
|
||||||
});
|
//{
|
||||||
|
// var sysOrg = _sysOrgRep.DetachedEntities.FirstOrDefault(c => c.Id == u);
|
||||||
|
// var parentAndChildIdListWithSelf = sysOrg.Pids.TrimEnd(',').Replace("[", "").Replace("]", "")
|
||||||
|
// .Split(",").ToList();
|
||||||
|
// dataScopeList.AddRange(parentAndChildIdListWithSelf);
|
||||||
|
//});
|
||||||
|
|
||||||
|
dataScopeList = dataScopes;
|
||||||
}
|
}
|
||||||
return dataScopeList.Distinct().ToList();
|
return dataScopeList.Distinct().ToList();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,22 @@ namespace Ewide.Core
|
|||||||
if (_rootParentIds.Contains(u.GetPid()))
|
if (_rootParentIds.Contains(u.GetPid()))
|
||||||
results.Add(u);
|
results.Add(u);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// 在未获取到根节点的情况下, 直接将最上级作为根节点
|
||||||
|
if (results.Count < 1)
|
||||||
|
{
|
||||||
|
var ids = new List<string>();
|
||||||
|
nodes.ForEach(u => {
|
||||||
|
ids.Add(u.GetId());
|
||||||
|
});
|
||||||
|
|
||||||
|
nodes.ForEach(u =>
|
||||||
|
{
|
||||||
|
if (!ids.Contains(u.GetPid()))
|
||||||
|
results.Add(u);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user