1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 07:49:41 +02:00

fix(auth): invalidate session when permissions change EE-3320 (#8103)

This commit is contained in:
Dakota Walsh 2022-12-14 10:12:00 +13:00 committed by GitHub
parent 930d9e5628
commit 0ddcad66f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -108,14 +108,15 @@ func (handler *Handler) userUpdate(w http.ResponseWriter, r *http.Request) *http
user.TokenIssueAt = time.Now().Unix()
}
if payload.Role != 0 {
user.Role = portainer.UserRole(payload.Role)
}
if payload.UserTheme != "" {
user.UserTheme = payload.UserTheme
}
if payload.Role != 0 {
user.Role = portainer.UserRole(payload.Role)
user.TokenIssueAt = time.Now().Unix()
}
err = handler.DataStore.User().UpdateUser(user.ID, user)
if err != nil {
return httperror.InternalServerError("Unable to persist user changes inside the database", err)