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

pull/8197/head
Dakota Walsh 2 years ago committed by GitHub
parent 930d9e5628
commit 0ddcad66f3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

@ -52,6 +52,9 @@ function StateManagerFactory(
};
manager.resetPasswordChangeSkips = function (userID) {
if (!state.UI.timesPasswordChangeSkipped) {
return;
}
if (state.UI.timesPasswordChangeSkipped[userID]) state.UI.timesPasswordChangeSkipped[userID] = 0;
LocalStorage.storeUIState(state.UI);
};

Loading…
Cancel
Save