diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityRoleAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityRoleAppService.cs index 9381a9b2c8..36f483d0e6 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityRoleAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityRoleAppService.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Threading.Tasks; using Volo.Abp.Application.Dtos; using Volo.Abp.Application.Services; diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleCreateOrUpdateDtoBase.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleCreateOrUpdateDtoBase.cs index c335c3c338..8e11d89b30 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleCreateOrUpdateDtoBase.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleCreateOrUpdateDtoBase.cs @@ -1,8 +1,9 @@ using System.ComponentModel.DataAnnotations; +using Volo.Abp.ObjectExtending; namespace Volo.Abp.Identity { - public class IdentityRoleCreateOrUpdateDtoBase + public class IdentityRoleCreateOrUpdateDtoBase : ExtensibleObject { [Required] [StringLength(IdentityRoleConsts.MaxNameLength)] diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleDto.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleDto.cs index d55b68fcb1..ae5d8a5feb 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleDto.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IdentityRoleDto.cs @@ -4,12 +4,12 @@ using Volo.Abp.Domain.Entities; namespace Volo.Abp.Identity { - public class IdentityRoleDto : EntityDto, IHasConcurrencyStamp + public class IdentityRoleDto : ExtensibleEntityDto, IHasConcurrencyStamp { public string Name { get; set; } public bool IsDefault { get; set; } - + public bool IsStatic { get; set; } public bool IsPublic { get; set; } diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpIdentityApplicationModuleAutoMapperProfile.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpIdentityApplicationModuleAutoMapperProfile.cs index d3886a334c..7910ff6dcb 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpIdentityApplicationModuleAutoMapperProfile.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/AbpIdentityApplicationModuleAutoMapperProfile.cs @@ -7,7 +7,10 @@ namespace Volo.Abp.Identity public AbpIdentityApplicationModuleAutoMapperProfile() { CreateMap(); - CreateMap(); + + CreateMap() + .MapExtraProperties(); + CreateMap(); } } diff --git a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs index 02d5f990f5..051251a70a 100644 --- a/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs +++ b/modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityRoleAppService.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Identity; using Volo.Abp.Application.Dtos; +using Volo.Abp.ObjectExtending; namespace Volo.Abp.Identity { @@ -24,14 +25,16 @@ namespace Volo.Abp.Identity public virtual async Task GetAsync(Guid id) { return ObjectMapper.Map( - await RoleManager.GetByIdAsync(id)); + await RoleManager.GetByIdAsync(id) + ); } public virtual async Task> GetAllListAsync() { var list = await RoleRepository.GetListAsync(); return new ListResultDto( - ObjectMapper.Map, List>(list)); + ObjectMapper.Map, List>(list) + ); } public virtual async Task> GetListAsync(PagedAndSortedResultRequestDto input) @@ -48,10 +51,17 @@ namespace Volo.Abp.Identity [Authorize(IdentityPermissions.Roles.Create)] public virtual async Task CreateAsync(IdentityRoleCreateDto input) { - var role = new IdentityRole(GuidGenerator.Create(), input.Name, CurrentTenant.Id); + var role = new IdentityRole( + GuidGenerator.Create(), + input.Name, + CurrentTenant.Id + ) + { + IsDefault = input.IsDefault, + IsPublic = input.IsPublic + }; - role.IsDefault = input.IsDefault; - role.IsPublic = input.IsPublic; + input.MapExtraPropertiesTo(role); (await RoleManager.CreateAsync(role)).CheckErrors(); await CurrentUnitOfWork.SaveChangesAsync(); @@ -70,6 +80,8 @@ namespace Volo.Abp.Identity role.IsDefault = input.IsDefault; role.IsPublic = input.IsPublic; + input.MapExtraPropertiesTo(role); + (await RoleManager.UpdateAsync(role)).CheckErrors(); await CurrentUnitOfWork.SaveChangesAsync();