From 56955627b27707686b5ee041ca0bbdb980eae717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Tue, 26 Sep 2023 10:36:19 +0300 Subject: [PATCH] Implemented controller and revised HttpClientExternalUserLookupServiceProvider --- ...ClientExternalUserLookupServiceProvider.cs | 15 +++++----- .../IdentityUserIntegrationController.cs | 30 +++++++++++++++++++ 2 files changed, 38 insertions(+), 7 deletions(-) diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientExternalUserLookupServiceProvider.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientExternalUserLookupServiceProvider.cs index 1c824db402..d73e09748d 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientExternalUserLookupServiceProvider.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientExternalUserLookupServiceProvider.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; using Volo.Abp.DependencyInjection; +using Volo.Abp.Identity.Integration; using Volo.Abp.Users; namespace Volo.Abp.Identity; @@ -11,21 +12,21 @@ namespace Volo.Abp.Identity; [Dependency(TryRegister = true)] public class HttpClientExternalUserLookupServiceProvider : IExternalUserLookupServiceProvider, ITransientDependency { - protected IIdentityUserLookupAppService UserLookupAppService { get; } + protected IIdentityUserIntegrationService IdentityUserIntegrationService { get; } - public HttpClientExternalUserLookupServiceProvider(IIdentityUserLookupAppService userLookupAppService) + public HttpClientExternalUserLookupServiceProvider(IIdentityUserIntegrationService identityUserIntegrationService) { - UserLookupAppService = userLookupAppService; + IdentityUserIntegrationService = identityUserIntegrationService; } public virtual async Task FindByIdAsync(Guid id, CancellationToken cancellationToken = default) { - return await UserLookupAppService.FindByIdAsync(id); + return await IdentityUserIntegrationService.FindByIdAsync(id); } public virtual async Task FindByUserNameAsync(string userName, CancellationToken cancellationToken = default) { - return await UserLookupAppService.FindByUserNameAsync(userName); + return await IdentityUserIntegrationService.FindByUserNameAsync(userName); } public async Task> SearchAsync( @@ -35,7 +36,7 @@ public class HttpClientExternalUserLookupServiceProvider : IExternalUserLookupSe int skipCount = 0, CancellationToken cancellationToken = default) { - var result = await UserLookupAppService.SearchAsync( + var result = await IdentityUserIntegrationService.SearchAsync( new UserLookupSearchInputDto { Filter = filter, @@ -52,7 +53,7 @@ public class HttpClientExternalUserLookupServiceProvider : IExternalUserLookupSe string filter = null, CancellationToken cancellationToken = new CancellationToken()) { - return await UserLookupAppService + return await IdentityUserIntegrationService .GetCountAsync( new UserLookupCountInputDto { diff --git a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/Integration/IdentityUserIntegrationController.cs b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/Integration/IdentityUserIntegrationController.cs index 3cb180e62b..e78691b1ac 100644 --- a/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/Integration/IdentityUserIntegrationController.cs +++ b/modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/Integration/IdentityUserIntegrationController.cs @@ -1,7 +1,9 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Volo.Abp.Application.Dtos; using Volo.Abp.AspNetCore.Mvc; +using Volo.Abp.Users; namespace Volo.Abp.Identity.Integration; @@ -24,4 +26,32 @@ public class IdentityUserIntegrationController : AbpControllerBase, IIdentityUse { return UserIntegrationService.GetRoleNamesAsync(id); } + + [HttpGet] + [Route("{id}")] + public Task FindByIdAsync(Guid id) + { + return UserIntegrationService.FindByIdAsync(id); + } + + [HttpGet] + [Route("by-username/{userName}")] + public Task FindByUserNameAsync(string userName) + { + return UserIntegrationService.FindByUserNameAsync(userName); + } + + [HttpGet] + [Route("search")] + public Task> SearchAsync(UserLookupSearchInputDto input) + { + return UserIntegrationService.SearchAsync(input); + } + + [HttpGet] + [Route("count")] + public Task GetCountAsync(UserLookupCountInputDto input) + { + return UserIntegrationService.GetCountAsync(input); + } } \ No newline at end of file