Browse Source

Fix identity module ExtraProperties errors

pull/6114/head
Halil İbrahim Kalkan 5 years ago
parent
commit
f475d42989
  1. 7
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentitySecurityLog.cs
  2. 4
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs
  3. 19
      templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameModuleExtensionConfigurator.cs

7
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentitySecurityLog.cs

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using Volo.Abp.Domain.Entities;
using Volo.Abp.Guids;
using Volo.Abp.MultiTenancy;
@ -35,12 +34,12 @@ namespace Volo.Abp.Identity
protected IdentitySecurityLog()
{
ExtraProperties = new Dictionary<string, object>();
}
public IdentitySecurityLog(IGuidGenerator guidGenerator, SecurityLogInfo securityLogInfo)
: base(guidGenerator.Create())
{
Id = guidGenerator.Create();
TenantId = securityLogInfo.TenantId;
TenantName = securityLogInfo.TenantName.Truncate(IdentitySecurityLogConsts.MaxTenantNameLength);
@ -57,8 +56,6 @@ namespace Volo.Abp.Identity
ClientId = securityLogInfo.ClientId.Truncate(IdentitySecurityLogConsts.MaxClientIdLength);
CorrelationId = securityLogInfo.CorrelationId.Truncate(IdentitySecurityLogConsts.MaxCorrelationIdLength);
BrowserInfo = securityLogInfo.BrowserInfo.Truncate(IdentitySecurityLogConsts.MaxBrowserInfoLength);
ExtraProperties = securityLogInfo.ExtraProperties;
}
}
}

4
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityUser.cs

@ -143,11 +143,11 @@ namespace Volo.Abp.Identity
[NotNull] string userName,
[NotNull] string email,
Guid? tenantId = null)
: base(id)
{
Check.NotNull(userName, nameof(userName));
Check.NotNull(email, nameof(email));
Id = id;
TenantId = tenantId;
UserName = userName;
NormalizedUserName = userName.ToUpperInvariant();
@ -161,8 +161,6 @@ namespace Volo.Abp.Identity
Logins = new Collection<IdentityUserLogin>();
Tokens = new Collection<IdentityUserToken>();
OrganizationUnits = new Collection<IdentityUserOrganizationUnit>();
ExtraProperties = new Dictionary<string, object>();
}
public virtual void AddRole(Guid roleId)

19
templates/app/aspnet-core/src/MyCompanyName.MyProjectName.Domain.Shared/MyProjectNameModuleExtensionConfigurator.cs

@ -37,6 +37,25 @@ namespace MyCompanyName.MyProjectName
private static void ConfigureExtraProperties()
{
ObjectExtensionManager.Instance.Modules()
.ConfigureIdentity(identity =>
{
identity.ConfigureUser(user =>
{
user.AddOrUpdateProperty<string>( //property type: string
"SocialSecurityNumber", //property name
property =>
{
//validation rules
property.Attributes.Add(new RequiredAttribute());
property.Attributes.Add(new StringLengthAttribute(64) {MinimumLength = 4});
//...other configurations for this property
}
);
});
});
/* You can configure extra properties for the
* entities defined in the modules used by your application.
*

Loading…
Cancel
Save