Browse Source

Implemented controller and revised HttpClientExternalUserLookupServiceProvider

pull/17737/head
Halil İbrahim Kalkan 3 years ago
parent
commit
56955627b2
  1. 15
      modules/identity/src/Volo.Abp.Identity.HttpApi.Client/Volo/Abp/Identity/HttpClientExternalUserLookupServiceProvider.cs
  2. 30
      modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/Integration/IdentityUserIntegrationController.cs

15
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<IUserData> FindByIdAsync(Guid id, CancellationToken cancellationToken = default)
{
return await UserLookupAppService.FindByIdAsync(id);
return await IdentityUserIntegrationService.FindByIdAsync(id);
}
public virtual async Task<IUserData> FindByUserNameAsync(string userName, CancellationToken cancellationToken = default)
{
return await UserLookupAppService.FindByUserNameAsync(userName);
return await IdentityUserIntegrationService.FindByUserNameAsync(userName);
}
public async Task<List<IUserData>> 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
{

30
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<UserData> FindByIdAsync(Guid id)
{
return UserIntegrationService.FindByIdAsync(id);
}
[HttpGet]
[Route("by-username/{userName}")]
public Task<UserData> FindByUserNameAsync(string userName)
{
return UserIntegrationService.FindByUserNameAsync(userName);
}
[HttpGet]
[Route("search")]
public Task<ListResultDto<UserData>> SearchAsync(UserLookupSearchInputDto input)
{
return UserIntegrationService.SearchAsync(input);
}
[HttpGet]
[Route("count")]
public Task<long> GetCountAsync(UserLookupCountInputDto input)
{
return UserIntegrationService.GetCountAsync(input);
}
}
Loading…
Cancel
Save