Skip to content

Commit

Permalink
User sync is implemented at go-gitea#1478 - so only make sure that ad…
Browse files Browse the repository at this point in the history
…min acces is drpoed if changed
  • Loading branch information
6543 committed Nov 7, 2019
1 parent 7ab74eb commit 6c703ff
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
10 changes: 3 additions & 7 deletions models/login_source.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,14 +410,10 @@ func LoginViaLDAP(user *User, login, password string, source *LoginSource, autoR
} else if isExist {
if user.ProhibitLogin {
return nil, ErrUserProhibitLogin{user.ID, user.Name}
} else if len(source.LDAP().AdminFilter) > 0 && user.IsAdmin != sr.IsAdmin {
// Change existing admin flag only if AdminFilter option is set
go UpdateUserCols(user, "is_admin")
}
user.FullName = composeFullName(sr.Name, sr.Surname, sr.Username)
user.Email = sr.Mail
// Change existing admin flag only if AdminFilter option is set
if len(source.LDAP().AdminFilter) > 0 {
user.IsAdmin = sr.IsAdmin
}
go UpdateLdapUserAtLogin(user)
}

if !autoRegister {
Expand Down
7 changes: 0 additions & 7 deletions models/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -1827,10 +1827,3 @@ func SyncExternalUsers() {
}
}
}

func UpdateLdapUserAtLogin(user *User) (err error) {
if err := UpdateUserCols(user, "full_name", "email", "is_admin"); err != nil {
return err
}
return nil
}

0 comments on commit 6c703ff

Please sign in to comment.