Skip to content

Commit

Permalink
当前租户不需要影响用户所拥有的角色组,而应该在魔方里面独立处理
Browse files Browse the repository at this point in the history
  • Loading branch information
nnhy committed Oct 28, 2023
1 parent 3edcb2b commit a081c76
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions XCode/Membership/用户.Biz.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,14 @@ public override void Valid(Boolean isNew)
if (ids.Length > 0)
{
RoleID = ids[0];
var str = ids.Skip(1).Join();
if (!str.IsNullOrEmpty()) str = "," + str + ",";
RoleIds = str;
if (ids.Length == 1)
RoleIds = null;
else
{
var str = ids.Skip(1).Join();
if (!str.IsNullOrEmpty()) str = "," + str + ",";
RoleIds = str;
}
}

// 自动计算年龄
Expand Down Expand Up @@ -607,15 +612,15 @@ private Boolean DisableAdmin()
/// <returns></returns>
public virtual Int32[] GetRoleIDs()
{
var tenantId = (TenantContext.Current?.TenantId).ToInt(-1);
if (tenantId > 0)
{
var tuEntity = TenantUser.FindByTenantIdAndUserId(tenantId, ID);
var idlist = RoleIds.SplitAsInt().OrderBy(e => e).ToList();
if (tuEntity != null && tuEntity.RoleId > 0) idlist.Insert(0, tuEntity.RoleId);
//var tenantId = (TenantContext.Current?.TenantId).ToInt(-1);
//if (tenantId > 0)
//{
// var tuEntity = TenantUser.FindByTenantIdAndUserId(tenantId, ID);
// var idlist = RoleIds.SplitAsInt().OrderBy(e => e).ToList();
// if (tuEntity != null && tuEntity.RoleId > 0) idlist.Insert(0, tuEntity.RoleId);

return idlist.Distinct().ToArray();
}
// return idlist.Distinct().ToArray();
//}

var ids = RoleIds.SplitAsInt().OrderBy(e => e).ToList();
if (RoleID > 0) ids.Insert(0, RoleID);
Expand Down

0 comments on commit a081c76

Please sign in to comment.