diff --git a/controllers/store_secrets.go b/controllers/store_secrets.go index 787d36f..709e358 100644 --- a/controllers/store_secrets.go +++ b/controllers/store_secrets.go @@ -210,25 +210,15 @@ func UpdateSecret(c *gin.Context) { } */ - /* - user_id, err := token.ExtractTokenID(c) - if err != nil { - c.JSON(http.StatusBadRequest, gin.H{"error": "error determining user"}) - return - } - */ - log.Printf("c.Keys: %v\n", c.Keys) - //user_id := c.GetInt("user-id") - + // Get userId that we stored in the context earlier if val, ok := c.Get("user-id"); !ok { c.JSON(http.StatusBadRequest, gin.H{"error": "error determining user"}) return } else { user_id = val.(int) + //log.Printf("user_id: %v\n", user_id) } - log.Printf("user_id: %v\n", user_id) - // Populate fields s := models.Secret{} diff --git a/models/secret.go b/models/secret.go index 89153b4..577f945 100644 --- a/models/secret.go +++ b/models/secret.go @@ -28,6 +28,7 @@ type Secret struct { type UserSecret struct { User Group + Permission Secret }