|
|
|
@ -12,13 +12,16 @@ namespace Volo.Abp.Identity |
|
|
|
{ |
|
|
|
protected IdentityUserManager UserManager { get; } |
|
|
|
protected IIdentityUserRepository UserRepository { get; } |
|
|
|
public IIdentityRoleRepository RoleRepository { get; } |
|
|
|
|
|
|
|
public IdentityUserAppService( |
|
|
|
IdentityUserManager userManager, |
|
|
|
IIdentityUserRepository userRepository) |
|
|
|
IIdentityUserRepository userRepository, |
|
|
|
IIdentityRoleRepository roleRepository) |
|
|
|
{ |
|
|
|
UserManager = userManager; |
|
|
|
UserRepository = userRepository; |
|
|
|
RoleRepository = roleRepository; |
|
|
|
} |
|
|
|
|
|
|
|
//TODO: [Authorize(IdentityPermissions.Users.Default)] should go the IdentityUserAppService class.
|
|
|
|
@ -54,6 +57,14 @@ namespace Volo.Abp.Identity |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
[Authorize(IdentityPermissions.Users.Default)] |
|
|
|
public virtual async Task<ListResultDto<IdentityRoleDto>> GetAssignableRolesAsync() |
|
|
|
{ |
|
|
|
var list = await RoleRepository.GetListAsync(); |
|
|
|
return new ListResultDto<IdentityRoleDto>( |
|
|
|
ObjectMapper.Map<List<IdentityRole>, List<IdentityRoleDto>>(list)); |
|
|
|
} |
|
|
|
|
|
|
|
[Authorize(IdentityPermissions.Users.Create)] |
|
|
|
public virtual async Task<IdentityUserDto> CreateAsync(IdentityUserCreateDto input) |
|
|
|
{ |
|
|
|
@ -92,7 +103,7 @@ namespace Volo.Abp.Identity |
|
|
|
(await UserManager.RemovePasswordAsync(user)).CheckErrors(); |
|
|
|
(await UserManager.AddPasswordAsync(user, input.Password)).CheckErrors(); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
await CurrentUnitOfWork.SaveChangesAsync(); |
|
|
|
|
|
|
|
return ObjectMapper.Map<IdentityUser, IdentityUserDto>(user); |
|
|
|
|