This commit is contained in:
@@ -59,7 +59,15 @@ func JwtAuthAdminMiddleware() gin.HandlerFunc {
|
|||||||
log.Printf("JwtAuthAdminMiddleware determined user id as '%v'\n", user_id)
|
log.Printf("JwtAuthAdminMiddleware determined user id as '%v'\n", user_id)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
user_id := c.GetInt("user-id")
|
//user_id := c.GetInt("user-id")
|
||||||
|
var user_id int
|
||||||
|
if val, ok := c.Get("user-id"); !ok {
|
||||||
|
log.Printf("JwtAuthAdminMiddleware : user-id not in context. Keys : '%+v'\n", c.Keys)
|
||||||
|
c.JSON(http.StatusBadRequest, gin.H{"error": "error determining user id"})
|
||||||
|
return
|
||||||
|
} else {
|
||||||
|
user_id = val.(int)
|
||||||
|
}
|
||||||
|
|
||||||
if user_id == 0 {
|
if user_id == 0 {
|
||||||
errString := "could not extract user ID from context"
|
errString := "could not extract user ID from context"
|
||||||
|
Reference in New Issue
Block a user