add Permission to struct
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-09 11:53:38 +11:00
parent 3186fe9ebc
commit 1c3d82ffba
2 changed files with 3 additions and 12 deletions

View File

@@ -210,25 +210,15 @@ func UpdateSecret(c *gin.Context) {
} }
*/ */
/* // Get userId that we stored in the context earlier
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")
if val, ok := c.Get("user-id"); !ok { if val, ok := c.Get("user-id"); !ok {
c.JSON(http.StatusBadRequest, gin.H{"error": "error determining user"}) c.JSON(http.StatusBadRequest, gin.H{"error": "error determining user"})
return return
} else { } else {
user_id = val.(int) user_id = val.(int)
//log.Printf("user_id: %v\n", user_id)
} }
log.Printf("user_id: %v\n", user_id)
// Populate fields // Populate fields
s := models.Secret{} s := models.Secret{}

View File

@@ -28,6 +28,7 @@ type Secret struct {
type UserSecret struct { type UserSecret struct {
User User
Group Group
Permission
Secret Secret
} }