From 234024cb6afb40fd42df09d195d1f15ab912534a Mon Sep 17 00:00:00 2001 From: maliming Date: Fri, 23 Oct 2020 11:36:52 +0800 Subject: [PATCH] Add Filter parameter to GetListAsync method of IIdentityRoleAppService. Resolve #5814 --- .../Volo/Abp/Identity/GetIdentityRolesInput.cs | 9 +++++++++ .../Volo/Abp/Identity/IIdentityRoleAppService.cs | 2 +- .../Volo/Abp/Identity/IdentityRoleAppService.cs | 8 ++++---- .../Pages/Identity/RoleManagement.razor.cs | 3 +-- .../Volo/Abp/Identity/IdentityRoleController.cs | 2 +- .../Volo/Abp/Identity/IdentityRoleAppService_Tests.cs | 4 ++-- 6 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/GetIdentityRolesInput.cs diff --git a/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/GetIdentityRolesInput.cs b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/GetIdentityRolesInput.cs new file mode 100644 index 0000000000..c5db3405a8 --- /dev/null +++ b/modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/GetIdentityRolesInput.cs @@ -0,0 +1,9 @@ +using Volo.Abp.Application.Dtos; + +namespace Volo.Abp.Identity +{ + public class GetIdentityRolesInput : PagedAndSortedResultRequestDto + { + public string Filter { get; set; } + } +} 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 24969c1ed5..2bd855927d 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 @@ -9,7 +9,7 @@ namespace Volo.Abp.Identity : ICrudAppService< IdentityRoleDto, Guid, - PagedAndSortedResultRequestDto, + GetIdentityRolesInput, IdentityRoleCreateDto, IdentityRoleUpdateDto> { 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 051251a70a..9eecb1058e 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 @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; @@ -37,9 +37,9 @@ namespace Volo.Abp.Identity ); } - public virtual async Task> GetListAsync(PagedAndSortedResultRequestDto input) + public virtual async Task> GetListAsync(GetIdentityRolesInput input) { - var list = await RoleRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount); + var list = await RoleRepository.GetListAsync(input.Sorting, input.MaxResultCount, input.SkipCount, input.Filter); var totalCount = await RoleRepository.GetCountAsync(); return new PagedResultDto( @@ -57,7 +57,7 @@ namespace Volo.Abp.Identity CurrentTenant.Id ) { - IsDefault = input.IsDefault, + IsDefault = input.IsDefault, IsPublic = input.IsPublic }; diff --git a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs index bccf3ddbd8..434a2604d2 100644 --- a/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs +++ b/modules/identity/src/Volo.Abp.Identity.Blazor/Pages/Identity/RoleManagement.razor.cs @@ -1,13 +1,12 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; -using Volo.Abp.Application.Dtos; using Volo.Abp.BlazoriseUI; using Volo.Abp.PermissionManagement.Blazor.Components; namespace Volo.Abp.Identity.Blazor.Pages.Identity { - public abstract class RoleManagementBase : AbpCrudPageBase + public abstract class RoleManagementBase : AbpCrudPageBase { protected const string PermissionProviderName = "R"; diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs index 5d563b127e..150256badd 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityRoleController.cs @@ -27,7 +27,7 @@ namespace Volo.Abp.Identity } [HttpGet] - public virtual Task> GetListAsync(PagedAndSortedResultRequestDto input) + public virtual Task> GetListAsync(GetIdentityRolesInput input) { return RoleAppService.GetListAsync(input); } diff --git a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs index 5d64bb6c78..ce2ba8b511 100644 --- a/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs +++ b/modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityRoleAppService_Tests.cs @@ -45,13 +45,13 @@ namespace Volo.Abp.Identity result.Items.Count.ShouldBeGreaterThan(0); } - + [Fact] public async Task GetListAsync() { //Act - var result = await _roleAppService.GetListAsync(new PagedAndSortedResultRequestDto()); + var result = await _roleAppService.GetListAsync(new GetIdentityRolesInput()); //Assert