diff --git a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityErrorCodes.cs b/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityErrorCodes.cs index d5e57a6953..1defe67eeb 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain.Shared/Volo/Abp/Identity/IdentityErrorCodes.cs +++ b/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"; } } diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs index d2f2cb4a69..40c249e5c4 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/IdentityRoleManager.cs +++ b/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); diff --git a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnitManager.cs b/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnitManager.cs index d03e56af79..ec794a51df 100644 --- a/modules/identity/src/Volo.Abp.Identity.Domain/Volo/Abp/Identity/OrganizationUnitManager.cs +++ b/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); } }