aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-19 15:10:06 +0900
committernsfisis <nsfisis@gmail.com>2025-09-19 15:10:06 +0900
commit2c9033191a371fc587bdb47a0047e49818e55130 (patch)
treee6d350924ce60288759d1cd113af6f8e08f473be
parent9eeb60e0d5d9c640837dce54ae7c2e800db15ce3 (diff)
downloadiosdc-japan-2025-albatross-2c9033191a371fc587bdb47a0047e49818e55130.tar.gz
iosdc-japan-2025-albatross-2c9033191a371fc587bdb47a0047e49818e55130.tar.zst
iosdc-japan-2025-albatross-2c9033191a371fc587bdb47a0047e49818e55130.zip
feat(backend): allow admin to access private gamesHEADmain
-rw-r--r--backend/api/handler.go4
1 files changed, 2 insertions, 2 deletions
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",