Make isAdmin async
This commit is contained in:
@@ -87,7 +87,7 @@ public class BotController : BaseController
|
||||
return false;
|
||||
|
||||
// Admin users can access all bots
|
||||
if (_adminService.IsUserAdmin(user.Name))
|
||||
if (await _adminService.IsUserAdminAsync(user.Name))
|
||||
return true;
|
||||
|
||||
if (identifier != default)
|
||||
|
||||
@@ -46,7 +46,7 @@ public class SqlMonitoringController : BaseController
|
||||
if (user == null)
|
||||
return false;
|
||||
|
||||
return _adminService.IsUserAdmin(user.Name);
|
||||
return await _adminService.IsUserAdminAsync(user.Name);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -220,7 +220,7 @@ public class TradingController : BaseController
|
||||
private async Task<bool> CanUserInitializeAddress(string userName, string publicAddress)
|
||||
{
|
||||
// Admin users can initialize any address
|
||||
if (_adminService.IsUserAdmin(userName))
|
||||
if (await _adminService.IsUserAdminAsync(userName))
|
||||
{
|
||||
_logger.LogInformation("Admin user {UserName} initializing address {Address}", userName, publicAddress);
|
||||
return true;
|
||||
|
||||
@@ -49,10 +49,10 @@ public class WhitelistController : BaseController
|
||||
{
|
||||
var user = await GetUser();
|
||||
|
||||
if (!_adminService.IsUserAdmin(user.Name))
|
||||
if (!await _adminService.IsUserAdminAsync(user.Name))
|
||||
{
|
||||
_logger.LogWarning("User {UserName} attempted to list whitelist accounts without admin privileges", user.Name);
|
||||
return Forbid("Only admin users can list whitelist accounts");
|
||||
return StatusCode(403, new { error = "Only admin users can list whitelist accounts" });
|
||||
}
|
||||
|
||||
try
|
||||
@@ -89,10 +89,10 @@ public class WhitelistController : BaseController
|
||||
{
|
||||
var user = await GetUser();
|
||||
|
||||
if (!_adminService.IsUserAdmin(user.Name))
|
||||
if (!await _adminService.IsUserAdminAsync(user.Name))
|
||||
{
|
||||
_logger.LogWarning("User {UserName} attempted to set whitelisted status without admin privileges", user.Name);
|
||||
return Forbid("Only admin users can set whitelisted status");
|
||||
return StatusCode(403, new { error = "Only admin users can set whitelisted status" });
|
||||
}
|
||||
|
||||
try
|
||||
|
||||
Reference in New Issue
Block a user