Skip to content

Commit

Permalink
fix: #dev gamerecord admin fix
Browse files Browse the repository at this point in the history
  • Loading branch information
marcinbator committed Oct 21, 2024
1 parent 1cdaff1 commit 7a3f710
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rag-2-backend/Controllers/GameRecordController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void AddGameRecord([FromBody] [Required] RecordedGameRequest request)
gameRecordService.AddGameRecord(request, UserUtil.GetPrincipalEmail(User));
}

/// <summary>Remove game recording, admin can remove everyone's data (Auth)</summary>
/// <summary>Remove game recording (Auth)</summary>
/// <response code="404">User or game record not found</response>
/// <response code="403">Permission denied</response>
[HttpDelete]
Expand Down
2 changes: 1 addition & 1 deletion rag-2-backend/Services/GameRecordService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public void RemoveGameRecord(int gameRecordId, string email)
var user = userUtil.GetUserByEmailOrThrow(email);
var recordedGame = GetRecordedGameById(gameRecordId);

if (user.Id != recordedGame.User.Id && user.Role != Role.Admin)
if (user.Id != recordedGame.User.Id)
throw new BadRequestException("Permission denied");

context.RecordedGames.Remove(recordedGame);
Expand Down

0 comments on commit 7a3f710

Please sign in to comment.