This commit is contained in:
@@ -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
|
||||||
|
@@ -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)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user