Unauthorized changet to Forbid

This commit is contained in:
Artemy
2025-07-21 17:16:51 +07:00
parent 4054e4046a
commit 93004a26b3
3 changed files with 4 additions and 9 deletions
+3 -3
View File
@@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Mvc;
namespace Govor.API.Controllers;
[ApiController]
[Authorize]
[Authorize(Roles = "Admin, User")]
[Route("api/chats")]
public class ChatLoadController : Controller
{
@@ -49,7 +49,7 @@ public class ChatLoadController : Controller
catch (UnauthorizedAccessException ex)
{
_logger.LogWarning(ex.Message);
return Unauthorized(ex.Message);
return Forbid(ex.Message);
}
catch (Exception ex)
{
@@ -84,7 +84,7 @@ public class ChatLoadController : Controller
catch (UnauthorizedAccessException ex)
{
_logger.LogWarning(ex.Message);
return Unauthorized(ex.Message);
return Forbid(ex.Message);
}
catch (Exception ex)
{
+1 -1
View File
@@ -68,7 +68,7 @@ public class MediaController : Controller
catch (UnauthorizedAccessException ex)
{
_logger.LogWarning(ex, ex.Message);
return Unauthorized(ex.Message);
return Forbid(ex.Message);
}
catch (InvalidOperationException ex)
{
@@ -43,11 +43,6 @@ public class OnlinePingingController : Controller
_logger.LogError(e, e.Message);
return BadRequest("User can't be found in our database.");
}
catch (UnauthorizedAccessException e)
{
_logger.LogError(e, e.Message);
return Forbid(e.Message);
}
catch (Exception e)
{
_logger.LogError(e, e.Message);