def get_or_create_user(self, username, ldap_user): """ This must return a (User, created) 2-tuple for the given LDAP user. username is the Django-friendly username of the user. ldap_user.dn is the user's DN and ldap_user.attrs contains all of their LDAP attributes. """ user, created = User.objects.get_or_create( username__iexact=username, defaults={'username': username.lower()}) if created: populate_callback(user) return user, created
def get_or_create_user(self, username, ldap_user): """ This must return a (User, created) 2-tuple for the given LDAP user. username is the Django-friendly username of the user. ldap_user.dn is the user's DN and ldap_user.attrs contains all of their LDAP attributes. """ user, created = User.objects.get_or_create( username__iexact=username, defaults={'username': username.lower()} ) if created: populate_callback(user) return user, created
def get_or_create_user(self, username, ldap_user): """ This must return a (User, created) 2-tuple for the given LDAP user. username is the Django-friendly username of the user. ldap_user.dn is the user's DN and ldap_user.attrs contains all of their LDAP attributes. """ lpart, domain = split_mailbox(username) if domain is None: return None user, created = User.objects.get_or_create( username__iexact=username, defaults={'username': username.lower(), 'is_local': False} ) if created: populate_callback(user) return user, created
def get_or_create_user(self, username, ldap_user): """ This must return a (User, created) 2-tuple for the given LDAP user. username is the Django-friendly username of the user. ldap_user.dn is the user's DN and ldap_user.attrs contains all of their LDAP attributes. """ lpart, domain = split_mailbox(username) if domain is None: return None user, created = User.objects.get_or_create( username__iexact=username, defaults={ 'username': username.lower(), 'is_local': False }) if created: populate_callback(user) return user, created