1 Commits

Author SHA1 Message Date
Adrian Zürcher
e9fdea664f read role every refresh 2025-11-08 12:00:09 +01:00

View File

@@ -164,9 +164,8 @@ func (aH *AccessHandler) Refresh(c *gin.Context) {
username := claims["username"].(string) username := claims["username"].(string)
id := int(claims["id"].(float64)) id := int(claims["id"].(float64))
role := claims["role"].(string)
_, hasError := aH.getUserFromDB(c, username) user, hasError := aH.getUserFromDB(c, username)
if hasError { if hasError {
return return
} }
@@ -177,7 +176,7 @@ func (aH *AccessHandler) Refresh(c *gin.Context) {
newAccess := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{ newAccess := jwt.NewWithClaims(jwt.SigningMethodHS256, jwt.MapClaims{
"id": id, "id": id,
"username": username, "username": username,
"role": role, "role": user.Role,
"exp": accessExp.Unix(), "exp": accessExp.Unix(),
}) })
accessString, _ := newAccess.SignedString(ACCESS_SECRET) accessString, _ := newAccess.SignedString(ACCESS_SECRET)