From 7a3f7106755519cdf65a3c78869541ee416c3354 Mon Sep 17 00:00:00 2001 From: Marcin Bator Date: Mon, 21 Oct 2024 22:01:30 +0200 Subject: [PATCH] fix: #dev gamerecord admin fix --- rag-2-backend/Controllers/GameRecordController.cs | 2 +- rag-2-backend/Services/GameRecordService.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/rag-2-backend/Controllers/GameRecordController.cs b/rag-2-backend/Controllers/GameRecordController.cs index 4ab3f21..1ae2ce6 100644 --- a/rag-2-backend/Controllers/GameRecordController.cs +++ b/rag-2-backend/Controllers/GameRecordController.cs @@ -50,7 +50,7 @@ public void AddGameRecord([FromBody] [Required] RecordedGameRequest request) gameRecordService.AddGameRecord(request, UserUtil.GetPrincipalEmail(User)); } - /// Remove game recording, admin can remove everyone's data (Auth) + /// Remove game recording (Auth) /// User or game record not found /// Permission denied [HttpDelete] diff --git a/rag-2-backend/Services/GameRecordService.cs b/rag-2-backend/Services/GameRecordService.cs index 4b344f6..3250e9a 100644 --- a/rag-2-backend/Services/GameRecordService.cs +++ b/rag-2-backend/Services/GameRecordService.cs @@ -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);