update
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-01-09 11:45:34 +11:00
parent 89bd1acc32
commit 4b62b75c78
2 changed files with 11 additions and 9 deletions

View File

@@ -191,7 +191,7 @@ func CheckUpdateSecretAllowed(s *models.Secret, user_id int) (int, error) {
func UpdateSecret(c *gin.Context) { func UpdateSecret(c *gin.Context) {
var err error var err error
var input StoreInput var input StoreInput
var user_id int //var user_id int
if err := c.ShouldBindJSON(&input); err != nil { if err := c.ShouldBindJSON(&input); err != nil {
c.JSON(http.StatusBadRequest, gin.H{"error": "UpdateSecret error binding to input JSON : " + err.Error()}) c.JSON(http.StatusBadRequest, gin.H{"error": "UpdateSecret error binding to input JSON : " + err.Error()})
@@ -217,13 +217,15 @@ func UpdateSecret(c *gin.Context) {
return return
} }
*/ */
//user_id := c.GetInt("user-id") 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

View File

@@ -56,7 +56,7 @@ func JwtAuthAdminMiddleware() gin.HandlerFunc {
c.Abort() c.Abort()
return return
} }
log.Printf("JwtAuthAdminMiddleware determined user id as '%v'\n", user_id) //log.Printf("JwtAuthAdminMiddleware determined user id as '%v'\n", user_id)
c.Set("user-id", user_id) c.Set("user-id", user_id)
/* /*