OIDC: Ensure subject IDs are unique and super-admins can edit them #782

Signed-off-by: Michael Mayer <michael@photoprism.app>
This commit is contained in:
Michael Mayer
2024-07-08 18:16:24 +02:00
parent fe54cc7ef3
commit 11e5246e33
97 changed files with 3502 additions and 3433 deletions

View File

@@ -67,18 +67,8 @@ func UpdateUser(router *gin.RouterGroup) {
// Get user from session.
u := s.User()
// Prevent super admins from locking themselves out.
if u.IsSuperAdmin() && u.Equal(m) && !f.CanLogin {
f.CanLogin = true
}
// Only allow super admins to change the authentication method.
if !u.IsSuperAdmin() {
f.AuthMethod = ""
}
// Save model with values from form.
if err = m.SaveForm(f, isAdmin); err != nil {
if err = m.SaveForm(f, u); err != nil {
event.AuditErr([]string{ClientIP(c), "session %s", "users", m.UserName, "update", err.Error()}, s.RefID)
AbortSaveFailed(c)
return