feat(api): управление ролями пользователя

This commit is contained in:
Mikhail Trubnikov
2023-12-06 10:20:20 +10:00
parent 3a5978a7f9
commit 437b1a4e7c
7 changed files with 243 additions and 1 deletions

View File

@@ -85,6 +85,19 @@ namespace PARR.API.Services.Implementations
}
public async Task UnlockUserAsync(string ipAddress)
{
await cacheService.DeleteCachedDataAsync(GetBlockKey(ipAddress));
}
public async Task RemoveCacheUserAsync(string ipAddress)
{
await cacheService.DeleteCachedDataAsync(GetAllowKey(ipAddress));
await cacheService.DeleteCachedDataAsync(GetBlockKey(ipAddress));
}
private string GetBlockKey(string ipAddress)
{
// d - deny

View File

@@ -18,5 +18,19 @@ namespace PARR.API.Services.Interfaces
/// <param name="ipAddress"></param>
/// <returns></returns>
Task<bool> UserIsBlockedAsync(string ipAddress);
/// <summary>
/// Удалить из кэша пользователя
/// </summary>
/// <param name="ipAddress"></param>
/// <returns></returns>
Task RemoveCacheUserAsync(string ipAddress);
/// <summary>
/// Разблокировать пользователя
/// </summary>
/// <param name="ipAddress"></param>
/// <returns></returns>
Task UnlockUserAsync(string ipAddress);
}
}