|
|
@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Identity; |
|
|
using Volo.Abp.Auditing; |
|
|
using Volo.Abp.Auditing; |
|
|
using Volo.Abp.Domain.Entities.Auditing; |
|
|
using Volo.Abp.Domain.Entities.Auditing; |
|
|
using Volo.Abp.Guids; |
|
|
using Volo.Abp.Guids; |
|
|
|
|
|
using Volo.Abp.Identity.Organizations; |
|
|
using Volo.Abp.ObjectMapping; |
|
|
using Volo.Abp.ObjectMapping; |
|
|
using Volo.Abp.Users; |
|
|
using Volo.Abp.Users; |
|
|
|
|
|
|
|
|
@ -125,6 +126,11 @@ namespace Volo.Abp.Identity |
|
|
/// </summary>
|
|
|
/// </summary>
|
|
|
public virtual ICollection<IdentityUserToken> Tokens { get; protected set; } |
|
|
public virtual ICollection<IdentityUserToken> Tokens { get; protected set; } |
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Navigation property for this organization units.
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public virtual ICollection<OrganizationUnitUser> OrganizationUnits { get; protected set; } |
|
|
|
|
|
|
|
|
protected IdentityUser() |
|
|
protected IdentityUser() |
|
|
{ |
|
|
{ |
|
|
ExtraProperties = new Dictionary<string, object>(); |
|
|
ExtraProperties = new Dictionary<string, object>(); |
|
|
@ -148,6 +154,7 @@ namespace Volo.Abp.Identity |
|
|
Claims = new Collection<IdentityUserClaim>(); |
|
|
Claims = new Collection<IdentityUserClaim>(); |
|
|
Logins = new Collection<IdentityUserLogin>(); |
|
|
Logins = new Collection<IdentityUserLogin>(); |
|
|
Tokens = new Collection<IdentityUserToken>(); |
|
|
Tokens = new Collection<IdentityUserToken>(); |
|
|
|
|
|
OrganizationUnits = new Collection<OrganizationUnitUser>(); |
|
|
|
|
|
|
|
|
ExtraProperties = new Dictionary<string, object>(); |
|
|
ExtraProperties = new Dictionary<string, object>(); |
|
|
} |
|
|
} |
|
|
@ -277,6 +284,37 @@ namespace Volo.Abp.Identity |
|
|
Tokens.RemoveAll(t => t.LoginProvider == loginProvider && t.Name == name); |
|
|
Tokens.RemoveAll(t => t.LoginProvider == loginProvider && t.Name == name); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public virtual void AddOrganizationUnit(Guid organizationUnitId) |
|
|
|
|
|
{ |
|
|
|
|
|
Check.NotNull(organizationUnitId, nameof(organizationUnitId)); |
|
|
|
|
|
|
|
|
|
|
|
if (IsInOrganizationUnit(organizationUnitId)) |
|
|
|
|
|
{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
OrganizationUnits.Add(new OrganizationUnitUser(TenantId, Id, organizationUnitId)); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public virtual void RemoveOrganizationUnit(Guid organizationUnitId) |
|
|
|
|
|
{ |
|
|
|
|
|
Check.NotNull(organizationUnitId, nameof(organizationUnitId)); |
|
|
|
|
|
|
|
|
|
|
|
if (IsInOrganizationUnit(organizationUnitId)) |
|
|
|
|
|
{ |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
OrganizationUnits.RemoveAll(ou => ou.OrganizationUnitId == organizationUnitId); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public virtual bool IsInOrganizationUnit(Guid organizationUnitId) |
|
|
|
|
|
{ |
|
|
|
|
|
Check.NotNull(organizationUnitId, nameof(organizationUnitId)); |
|
|
|
|
|
|
|
|
|
|
|
return OrganizationUnits.Any(ou => ou.OrganizationUnitId == organizationUnitId); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public override string ToString() |
|
|
public override string ToString() |
|
|
{ |
|
|
{ |
|
|
return $"{base.ToString()}, UserName = {UserName}"; |
|
|
return $"{base.ToString()}, UserName = {UserName}"; |
|
|
|