mirror of
https://gitee.com/dotnetchina/OpenAuth.Net.git
synced 2025-09-20 18:47:55 +08:00
全面修改Id为Guid类型,为2.0版做准备
This commit is contained in:
@@ -28,7 +28,7 @@ namespace OpenAuth.App
|
||||
/// </summary>
|
||||
/// <param name="orgId">The org unique identifier.</param>
|
||||
/// <returns>IEnumerable{Org}.</returns>
|
||||
public IList<Org> LoadDirectChildren(int orgId)
|
||||
public IList<Org> LoadDirectChildren(Guid orgId)
|
||||
{
|
||||
return _repository.Find(u => u.ParentId == orgId).ToList();
|
||||
}
|
||||
@@ -37,7 +37,7 @@ namespace OpenAuth.App
|
||||
/// 得到部门的所有子部门
|
||||
/// <para>如果orgId为0,表示取得所有部门</para>
|
||||
/// </summary>
|
||||
public IList<Org> LoadAllChildren(int orgId)
|
||||
public IList<Org> LoadAllChildren(Guid orgId)
|
||||
{
|
||||
return _repository.GetSubOrgs(orgId).ToList();
|
||||
}
|
||||
@@ -48,10 +48,10 @@ namespace OpenAuth.App
|
||||
/// <param name="org">The org.</param>
|
||||
/// <returns>System.Int32.</returns>
|
||||
/// <exception cref="System.Exception">未能找到该组织的父节点信息</exception>
|
||||
public int AddOrUpdate(Org org)
|
||||
public Guid AddOrUpdate(Org org)
|
||||
{
|
||||
ChangeModuleCascade(org);
|
||||
if (org.Id == 0)
|
||||
if (org.Id == Guid.Empty)
|
||||
{
|
||||
_repository.Add(org);
|
||||
}
|
||||
@@ -66,7 +66,7 @@ namespace OpenAuth.App
|
||||
/// <summary>
|
||||
/// 删除指定ID的部门及其所有子部门
|
||||
/// </summary>
|
||||
public void DelOrg(int id)
|
||||
public void DelOrg(Guid id)
|
||||
{
|
||||
var delOrg = _repository.FindSingle(u => u.Id == id);
|
||||
if (delOrg == null) return;
|
||||
@@ -80,7 +80,7 @@ namespace OpenAuth.App
|
||||
/// TODO:这里会加载用户及用户角色的所有角色,“为用户分配角色”功能会给人一种混乱的感觉,但可以接受
|
||||
/// </summary>
|
||||
/// <param name="userId">The user unique identifier.</param>
|
||||
public List<Org> LoadForUser(int userId)
|
||||
public List<Org> LoadForUser(Guid userId)
|
||||
{
|
||||
//用户角色
|
||||
var userRoleIds =
|
||||
@@ -101,7 +101,7 @@ namespace OpenAuth.App
|
||||
/// 加载特定角色的角色
|
||||
/// </summary>
|
||||
/// <param name="roleId">The role unique identifier.</param>
|
||||
public List<Org> LoadForRole(int roleId)
|
||||
public List<Org> LoadForRole(Guid roleId)
|
||||
{
|
||||
var moduleIds =
|
||||
_relevanceRepository.Find(u => u.FirstId == roleId && u.Key == "RoleAccessedOrg")
|
||||
@@ -125,7 +125,7 @@ namespace OpenAuth.App
|
||||
if (currentCascadeId <= objCascadeId) currentCascadeId = objCascadeId + 1;
|
||||
}
|
||||
|
||||
if (org.ParentId != 0)
|
||||
if (org.ParentId != Guid.Empty)
|
||||
{
|
||||
var parentOrg = _repository.FindSingle(o => o.Id == org.ParentId);
|
||||
if (parentOrg != null)
|
||||
|
Reference in New Issue
Block a user