From 2c9033191a371fc587bdb47a0047e49818e55130 Mon Sep 17 00:00:00 2001 From: nsfisis Date: Fri, 19 Sep 2025 15:10:06 +0900 Subject: feat(backend): allow admin to access private games --- backend/api/handler.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'backend/api') diff --git a/backend/api/handler.go b/backend/api/handler.go index f7595dc..674424f 100644 --- a/backend/api/handler.go +++ b/backend/api/handler.go @@ -116,7 +116,7 @@ func (h *Handler) GetGames(ctx context.Context, _ GetGamesRequestObject, _ *auth }, nil } -func (h *Handler) GetGame(ctx context.Context, request GetGameRequestObject, _ *auth.JWTClaims) (GetGameResponseObject, error) { +func (h *Handler) GetGame(ctx context.Context, request GetGameRequestObject, user *auth.JWTClaims) (GetGameResponseObject, error) { gameID := request.GameID row, err := h.q.GetGameByID(ctx, int32(gameID)) if err != nil { @@ -129,7 +129,7 @@ func (h *Handler) GetGame(ctx context.Context, request GetGameRequestObject, _ * } return nil, echo.NewHTTPError(http.StatusInternalServerError, err.Error()) } - if !row.IsPublic { + if !row.IsPublic && !user.IsAdmin { return GetGame404JSONResponse{ NotFoundJSONResponse: NotFoundJSONResponse{ Message: "Game not found", -- cgit v1.2.3-70-g09d2