mirror of
https://github.com/aljazceru/btcpayserver.git
synced 2025-12-19 15:04:19 +01:00
Only checking for last admin if user being deleted is admin
Bugfixing issue #632
This commit is contained in:
committed by
Rockstar Developer
parent
420115c54d
commit
fee936b569
@@ -384,6 +384,9 @@ namespace BTCPayServer.Controllers
|
|||||||
if (user == null)
|
if (user == null)
|
||||||
return NotFound();
|
return NotFound();
|
||||||
|
|
||||||
|
var roles = await _UserManager.GetRolesAsync(user);
|
||||||
|
if (IsAdmin(roles))
|
||||||
|
{
|
||||||
var admins = await _UserManager.GetUsersInRoleAsync(Roles.ServerAdmin);
|
var admins = await _UserManager.GetUsersInRoleAsync(Roles.ServerAdmin);
|
||||||
if (admins.Count == 1)
|
if (admins.Count == 1)
|
||||||
{
|
{
|
||||||
@@ -392,10 +395,6 @@ namespace BTCPayServer.Controllers
|
|||||||
"This is the last Admin, so it can't be removed"));
|
"This is the last Admin, so it can't be removed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var roles = await _UserManager.GetRolesAsync(user);
|
|
||||||
if (IsAdmin(roles))
|
|
||||||
{
|
|
||||||
return View("Confirm", new ConfirmModel("Delete Admin " + user.Email,
|
return View("Confirm", new ConfirmModel("Delete Admin " + user.Email,
|
||||||
"Are you sure you want to delete this Admin and delete all accounts, users and data associated with the server account?",
|
"Are you sure you want to delete this Admin and delete all accounts, users and data associated with the server account?",
|
||||||
"Delete"));
|
"Delete"));
|
||||||
|
|||||||
Reference in New Issue
Block a user