Browse Source
Merge pull request #25564 from abpframework/auto-merge/rel-10-5/4620
Merge branch dev with rel-10.5
copilot/update-documentation-react-native
Volosoft Agent
4 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with
119 additions and
2 deletions
-
modules/identity/src/Volo.Abp.Identity.Application.Contracts/Volo/Abp/Identity/IIdentityUserAppService.cs
-
modules/identity/src/Volo.Abp.Identity.Application/Volo/Abp/Identity/IdentityUserAppService.cs
-
modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/Volo/Abp/Identity/IdentityUserClientProxy.Generated.cs
-
modules/identity/src/Volo.Abp.Identity.HttpApi.Client/ClientProxies/identity-generate-proxy.json
-
modules/identity/src/Volo.Abp.Identity.HttpApi/Volo/Abp/Identity/IdentityUserController.cs
-
modules/identity/src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs
-
modules/identity/src/Volo.Abp.Identity.Web/wwwroot/client-proxies/identity-proxy.js
-
modules/identity/test/Volo.Abp.Identity.Application.Tests/Volo/Abp/Identity/IdentityUserAppService_Tests.cs
|
|
|
@ -22,4 +22,6 @@ public interface IIdentityUserAppService |
|
|
|
Task<IdentityUserDto> FindByUsernameAsync(string userName); |
|
|
|
|
|
|
|
Task<IdentityUserDto> FindByEmailAsync(string email); |
|
|
|
|
|
|
|
Task<IdentityUserDto> FindByIdAsync(Guid id); |
|
|
|
} |
|
|
|
|
|
|
|
@ -180,6 +180,14 @@ public class IdentityUserAppService : IdentityAppServiceBase, IIdentityUserAppSe |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
[Authorize(IdentityPermissions.Users.Default)] |
|
|
|
public virtual async Task<IdentityUserDto> FindByIdAsync(Guid id) |
|
|
|
{ |
|
|
|
return ObjectMapper.Map<IdentityUser, IdentityUserDto>( |
|
|
|
await UserManager.FindByIdAsync(id.ToString()) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
protected virtual async Task UpdateUserByInput(IdentityUser user, IdentityUserCreateOrUpdateDtoBase input) |
|
|
|
{ |
|
|
|
if (!string.Equals(user.Email, input.Email, StringComparison.InvariantCultureIgnoreCase)) |
|
|
|
|
|
|
|
@ -58,6 +58,14 @@ public partial class IdentityUserClientProxy : ClientProxyBase<IIdentityUserAppS |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<IdentityUserDto> FindByIdAsync(Guid id) |
|
|
|
{ |
|
|
|
return await RequestAsync<IdentityUserDto>(nameof(FindByIdAsync), new ClientProxyRequestTypeValue |
|
|
|
{ |
|
|
|
{ typeof(Guid), id } |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<ListResultDto<IdentityRoleDto>> GetRolesAsync(Guid id) |
|
|
|
{ |
|
|
|
return await RequestAsync<ListResultDto<IdentityRoleDto>>(nameof(GetRolesAsync), new ClientProxyRequestTypeValue |
|
|
|
|
|
|
|
@ -487,6 +487,23 @@ |
|
|
|
"typeSimple": "Volo.Abp.Identity.IdentityUserDto" |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
"name": "FindByIdAsync", |
|
|
|
"parametersOnMethod": [ |
|
|
|
{ |
|
|
|
"name": "id", |
|
|
|
"typeAsString": "System.Guid, System.Private.CoreLib", |
|
|
|
"type": "System.Guid", |
|
|
|
"typeSimple": "string", |
|
|
|
"isOptional": false, |
|
|
|
"defaultValue": null |
|
|
|
} |
|
|
|
], |
|
|
|
"returnValue": { |
|
|
|
"type": "Volo.Abp.Identity.IdentityUserDto", |
|
|
|
"typeSimple": "Volo.Abp.Identity.IdentityUserDto" |
|
|
|
} |
|
|
|
}, |
|
|
|
{ |
|
|
|
"name": "GetAsync", |
|
|
|
"parametersOnMethod": [ |
|
|
|
@ -1019,6 +1036,43 @@ |
|
|
|
}, |
|
|
|
"allowAnonymous": null, |
|
|
|
"implementFrom": "Volo.Abp.Identity.IIdentityUserAppService" |
|
|
|
}, |
|
|
|
"FindByIdAsyncById": { |
|
|
|
"uniqueName": "FindByIdAsyncById", |
|
|
|
"name": "FindByIdAsync", |
|
|
|
"httpMethod": "GET", |
|
|
|
"url": "api/identity/users/by-id/{id}", |
|
|
|
"supportedVersions": [], |
|
|
|
"parametersOnMethod": [ |
|
|
|
{ |
|
|
|
"name": "id", |
|
|
|
"typeAsString": "System.Guid, System.Private.CoreLib", |
|
|
|
"type": "System.Guid", |
|
|
|
"typeSimple": "string", |
|
|
|
"isOptional": false, |
|
|
|
"defaultValue": null |
|
|
|
} |
|
|
|
], |
|
|
|
"parameters": [ |
|
|
|
{ |
|
|
|
"nameOnMethod": "id", |
|
|
|
"name": "id", |
|
|
|
"jsonName": null, |
|
|
|
"type": "System.Guid", |
|
|
|
"typeSimple": "string", |
|
|
|
"isOptional": false, |
|
|
|
"defaultValue": null, |
|
|
|
"constraintTypes": [], |
|
|
|
"bindingSourceId": "Path", |
|
|
|
"descriptorName": "" |
|
|
|
} |
|
|
|
], |
|
|
|
"returnValue": { |
|
|
|
"type": "Volo.Abp.Identity.IdentityUserDto", |
|
|
|
"typeSimple": "Volo.Abp.Identity.IdentityUserDto" |
|
|
|
}, |
|
|
|
"allowAnonymous": null, |
|
|
|
"implementFrom": "Volo.Abp.Identity.IIdentityUserAppService" |
|
|
|
} |
|
|
|
} |
|
|
|
}, |
|
|
|
|
|
|
|
@ -53,6 +53,13 @@ public class IdentityUserController : AbpControllerBase, IIdentityUserAppService |
|
|
|
return UserAppService.DeleteAsync(id); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpGet] |
|
|
|
[Route("by-id/{id}")] |
|
|
|
public virtual Task<IdentityUserDto> FindByIdAsync(Guid id) |
|
|
|
{ |
|
|
|
return UserAppService.FindByIdAsync(id); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpGet] |
|
|
|
[Route("{id}/roles")] |
|
|
|
public virtual Task<ListResultDto<IdentityRoleDto>> GetRolesAsync(Guid id) |
|
|
|
|
|
|
|
@ -83,8 +83,8 @@ public class EditModalModel : IdentityPageModel |
|
|
|
return null; |
|
|
|
} |
|
|
|
|
|
|
|
var user = await IdentityUserAppService.GetAsync(userId.Value); |
|
|
|
return user.UserName; |
|
|
|
var user = await IdentityUserAppService.FindByIdAsync(userId.Value); |
|
|
|
return user?.UserName; |
|
|
|
} |
|
|
|
|
|
|
|
public virtual async Task<IActionResult> OnPostAsync() |
|
|
|
|
|
|
|
@ -102,6 +102,13 @@ |
|
|
|
}, ajaxParams)); |
|
|
|
}; |
|
|
|
|
|
|
|
volo.abp.identity.identityUser.findById = function(id, ajaxParams) { |
|
|
|
return abp.ajax($.extend(true, { |
|
|
|
url: abp.appPath + 'api/identity/users/by-id/' + id + '', |
|
|
|
type: 'GET' |
|
|
|
}, ajaxParams)); |
|
|
|
}; |
|
|
|
|
|
|
|
volo.abp.identity.identityUser.getRoles = function(id, ajaxParams) { |
|
|
|
return abp.ajax($.extend(true, { |
|
|
|
url: abp.appPath + 'api/identity/users/' + id + '/roles', |
|
|
|
|
|
|
|
@ -51,6 +51,37 @@ public class IdentityUserAppService_Tests : AbpIdentityApplicationTestBase |
|
|
|
result.PhoneNumber.ShouldBe(johnNash.PhoneNumber); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task FindByIdAsync_Should_Return_User_When_Exists() |
|
|
|
{ |
|
|
|
var johnNash = GetUser("john.nash"); |
|
|
|
|
|
|
|
var result = await _userAppService.FindByIdAsync(johnNash.Id); |
|
|
|
|
|
|
|
result.ShouldNotBeNull(); |
|
|
|
result.Id.ShouldBe(johnNash.Id); |
|
|
|
result.UserName.ShouldBe(johnNash.UserName); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task FindByIdAsync_Should_Return_Null_When_User_Does_Not_Exist() |
|
|
|
{ |
|
|
|
var result = await _userAppService.FindByIdAsync(Guid.NewGuid()); |
|
|
|
|
|
|
|
result.ShouldBeNull(); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task FindByIdAsync_Should_Return_Null_When_User_Is_Soft_Deleted() |
|
|
|
{ |
|
|
|
var johnNash = GetUser("john.nash"); |
|
|
|
await _userAppService.DeleteAsync(johnNash.Id); |
|
|
|
|
|
|
|
var result = await _userAppService.FindByIdAsync(johnNash.Id); |
|
|
|
|
|
|
|
result.ShouldBeNull(); |
|
|
|
} |
|
|
|
|
|
|
|
[Fact] |
|
|
|
public async Task GetListAsync() |
|
|
|
{ |
|
|
|
|