Browse Source

improve IdentityErrorCodes

pull/5334/head
Yunus Emre Kalkan 6 years ago
parent
commit
8c0e0b08ce
  1. 3
      modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityErrorCodes.cs
  2. 4
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs
  3. 2
      modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnitManager.cs

3
modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityErrorCodes.cs

@ -5,5 +5,8 @@
public const string UserSelfDeletion = "Volo.Abp.Identity:010001";
public const string MaxAllowedOuMembership = "Volo.Abp.Identity:010002";
public const string ExternalUserPasswordChange = "Volo.Abp.Identity:010003";
public const string DuplicateOrganizationUnitDisplayName = "Volo.Abp.Identity:010004";
public const string StaticRoleRenaming = "Volo.Abp.Identity:010005";
public const string StaticRoleDeletion = "Volo.Abp.Identity:010006";
}
}

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

@ -54,7 +54,7 @@ namespace Volo.Abp.Identity
{
if (role.IsStatic && role.Name != name)
{
throw new BusinessException("Volo.Abp.Identity:010005");
throw new BusinessException(IdentityErrorCodes.StaticRoleRenaming);
}
return await base.SetRoleNameAsync(role, name);
@ -64,7 +64,7 @@ namespace Volo.Abp.Identity
{
if (role.IsStatic)
{
throw new BusinessException("Volo.Abp.Identity:010006");
throw new BusinessException(IdentityErrorCodes.StaticRoleDeletion);
}
return await base.DeleteAsync(role);

2
modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnitManager.cs

@ -131,7 +131,7 @@ namespace Volo.Abp.Identity
if (siblings.Any(ou => ou.DisplayName == organizationUnit.DisplayName))
{
throw new BusinessException("Volo.Abp.Identity:010004")
throw new BusinessException(IdentityErrorCodes.DuplicateOrganizationUnitDisplayName)
.WithData("0", organizationUnit.DisplayName);
}
}

Loading…
Cancel
Save