From bd59419a0ef40e1887625f3d9e2976dfe5713ea4 Mon Sep 17 00:00:00 2001 From: Adam French Date: Wed, 10 Dec 2025 06:27:25 +0000 Subject: [PATCH] temp admin necesitity --- backend/handlers/handle_post.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/backend/handlers/handle_post.go b/backend/handlers/handle_post.go index f2eb837..0991d59 100644 --- a/backend/handlers/handle_post.go +++ b/backend/handlers/handle_post.go @@ -59,6 +59,11 @@ func (store *Store) CreatePost(ctx *gin.Context) { } userID := uint(userIDF) + if !(*claims)["admin"].(bool) { + ctx.JSON(http.StatusForbidden, gin.H{"error": "you are not admin :("}) + return + } + // Create post post := models.Post{Title: input.Title, Content: input.Content, AuthorID: userID} tx := store.DB.Create(&post)