mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-05-14 05:42:27 +00:00
Use Unauthorized instead of Forbid on Website & Api
This commit is contained in:
parent
b0858448c8
commit
a603cdb002
2 changed files with 4 additions and 4 deletions
|
@ -105,7 +105,7 @@ public class UserEndpoints : ApiEndpointController
|
|||
string authToken = authHeader[(authHeader.IndexOf(' ') + 1)..];
|
||||
|
||||
ApiKeyEntity? apiKey = await this.database.APIKeys.FirstOrDefaultAsync(k => k.Key == authToken);
|
||||
if (apiKey == null) return this.Forbid();
|
||||
if (apiKey == null) return this.Unauthorized();
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(username))
|
||||
{
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ModerationSlotController : ControllerBase
|
|||
public async Task<IActionResult> TeamPick([FromRoute] int id)
|
||||
{
|
||||
UserEntity? user = this.database.UserFromWebRequest(this.Request);
|
||||
if (user == null || !user.IsModerator) return this.Forbid();
|
||||
if (user == null || !user.IsModerator) return this.Unauthorized();
|
||||
|
||||
SlotEntity? slot = await this.database.Slots.Include(s => s.Creator).FirstOrDefaultAsync(s => s.SlotId == id);
|
||||
if (slot == null) return this.NotFound();
|
||||
|
@ -43,7 +43,7 @@ public class ModerationSlotController : ControllerBase
|
|||
public async Task<IActionResult> RemoveTeamPick([FromRoute] int id)
|
||||
{
|
||||
UserEntity? user = this.database.UserFromWebRequest(this.Request);
|
||||
if (user == null || !user.IsModerator) return this.Forbid();
|
||||
if (user == null || !user.IsModerator) return this.Unauthorized();
|
||||
|
||||
SlotEntity? slot = await this.database.Slots.FirstOrDefaultAsync(s => s.SlotId == id);
|
||||
if (slot == null) return this.NotFound();
|
||||
|
@ -59,7 +59,7 @@ public class ModerationSlotController : ControllerBase
|
|||
public async Task<IActionResult> DeleteLevel([FromRoute] int id)
|
||||
{
|
||||
UserEntity? user = this.database.UserFromWebRequest(this.Request);
|
||||
if (user == null || !user.IsModerator) return this.Forbid();
|
||||
if (user == null || !user.IsModerator) return this.Unauthorized();
|
||||
|
||||
SlotEntity? slot = await this.database.Slots.FirstOrDefaultAsync(s => s.SlotId == id);
|
||||
if (slot == null) return this.Ok();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue