mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 06:21:44 +01:00
Add IsAdminUser method to UserService
This commit is contained in:
parent
53c81918a5
commit
b4076b53e8
2 changed files with 6 additions and 1 deletions
|
@ -198,7 +198,7 @@ namespace BTCPayServer.Controllers.GreenField
|
||||||
}
|
}
|
||||||
|
|
||||||
// We can safely delete the user if it's not an admin user
|
// We can safely delete the user if it's not an admin user
|
||||||
if (!_userService.IsRoleAdmin(await _userManager.GetRolesAsync(user)))
|
if (!(await _userService.IsAdminUser(user)))
|
||||||
{
|
{
|
||||||
await _userService.DeleteUserAndAssociatedData(user);
|
await _userService.DeleteUserAndAssociatedData(user);
|
||||||
|
|
||||||
|
|
|
@ -34,6 +34,11 @@ namespace BTCPayServer.Services
|
||||||
_storeRepository = storeRepository;
|
_storeRepository = storeRepository;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<bool> IsAdminUser(ApplicationUser user)
|
||||||
|
{
|
||||||
|
return IsRoleAdmin(await _userManager.GetRolesAsync(user));
|
||||||
|
}
|
||||||
|
|
||||||
public async Task DeleteUserAndAssociatedData(ApplicationUser user)
|
public async Task DeleteUserAndAssociatedData(ApplicationUser user)
|
||||||
{
|
{
|
||||||
var userId = user.Id;
|
var userId = user.Id;
|
||||||
|
|
Loading…
Add table
Reference in a new issue