Skip to content

Commit

Permalink
ensure that email attribute is set
Browse files Browse the repository at this point in the history
  • Loading branch information
h44z committed May 17, 2021
1 parent cadbe4a commit d165fc0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions internal/server/ldapsync.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ func (s *Server) disableMissingLdapUsers(ldapUsers []ldap.RawLdapData) {

func (s *Server) updateLdapUsers(ldapUsers []ldap.RawLdapData) {
for i := range ldapUsers {
if ldapUsers[i].Attributes[s.config.LDAP.EmailAttribute] == "" {
logrus.Tracef("skipping sync of %s, empty email attribute", ldapUsers[i].DN)
continue
}

user, err := s.users.GetOrCreateUserUnscoped(ldapUsers[i].Attributes[s.config.LDAP.EmailAttribute])
if err != nil {
logrus.Errorf("failed to get/create user %s in database: %v", ldapUsers[i].Attributes[s.config.LDAP.EmailAttribute], err)
Expand Down

0 comments on commit d165fc0

Please sign in to comment.