mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-18 06:24:24 +01:00
Remove unused IsAdmin method
This commit is contained in:
@@ -226,21 +226,6 @@ namespace BTCPayServer.Controllers.GreenField
|
|||||||
return Ok();
|
return Ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<Boolean> IsAdmin()
|
|
||||||
{
|
|
||||||
var anyAdmin = (await _userManager.GetUsersInRoleAsync(Roles.ServerAdmin)).Any();
|
|
||||||
// You are an admin if there are no other admins
|
|
||||||
if (!anyAdmin)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
var isAuth = User.Identity.AuthenticationType == GreenFieldConstants.AuthenticationType;
|
|
||||||
return (await _authorizationService.AuthorizeAsync(User, null, new PolicyRequirement(Policies.CanModifyServerSettings))).Succeeded
|
|
||||||
&& (await _authorizationService.AuthorizeAsync(User, null, new PolicyRequirement(Policies.Unrestricted))).Succeeded
|
|
||||||
&& isAuth;
|
|
||||||
}
|
|
||||||
|
|
||||||
private async Task<ApplicationUserData> FromModel(ApplicationUser data)
|
private async Task<ApplicationUserData> FromModel(ApplicationUser data)
|
||||||
{
|
{
|
||||||
var roles = (await _userManager.GetRolesAsync(data)).ToArray();
|
var roles = (await _userManager.GetRolesAsync(data)).ToArray();
|
||||||
|
|||||||
Reference in New Issue
Block a user