def doc_staff_search_filter(ldap_fields): # memberOf=CN=doc-staff,OU=Distribution,OU=Groups,OU=Imperial College (London),DC=ic,DC=ac,DC=uk ldap_fields[ "memberOf"] = "CN=doc-teaching-list,OU=Distribution,OU=Groups,OU=Imperial College (London),DC=ic,DC=ac,DC=uk" search_filters = format_search_filters(ldap_fields) return search_filters
def format_search_user_or_email(ldap_fields): user_field = settings.LDAP_AUTH_USER_FIELDS['username'] email_user_field = 'userPrincipalName' username = ldap_fields[user_field] if '@' in username: ldap_fields[email_user_field] = ldap_fields.pop(user_field) return format_search_filters(ldap_fields)
def gidNumber_search_filters(ldap_fields): search_filters = format_search_filters(ldap_fields) # admin gid: 2001, common users gid = 2000 search_filters.append( "(|(gidNumber=2000)(gidNumber=2001)(gidNumber=2050))") return search_filters
def custom_format_search_filters(ldap_fields): # Add in simple filters. ldap_fields["memberOf"] = "foo" # Call the base format callable. search_filters = format_search_filters(ldap_fields) # Advanced: apply custom LDAP filter logic. search_filters.append("(|(memberOf=groupA)(memberOf=GroupB))") # All done! return search_filters
def custom_format_search_filters(ldap_fields): # Add in simple filters. ldap_fields["memberOf"] = "CN=Guests,CN=Builtin,DC=net,DC=wi-fi-bar,DC=com" # Call the base format callable. search_filters = format_search_filters(ldap_fields) # Advanced: apply custom LDAP filter logic. #search_filters.append("(|(memberOf=noc)(memberOf=soc))") # All done! print(search_filters) return search_filters
def custom_format_search_filters(ldap_fields): # Add in simple filters. ldap_fields["objectclass"] = "person" # ldap_fields["groups"] = "App_Admin" # Call the base format callable. search_filters = format_search_filters(ldap_fields) # Advanced: apply custom LDAP filter logic. # search_filters.append("(|(memberOf=groupA)(memberOf=GroupB))") # search_filters.append("(memberOf=CN=OrganizerEKSA,OU=Groups,OU=BPM,OU=OU Awam,OU=KPM,DC=modnet,DC=mindef,DC=my)") # search_filters.append("(memberOf=CN=EKSA,OU=Groups,OU=BPM,OU=OU Awam,OU=KPM,DC=modnet,DC=mindef,DC=my)") # search_filters.append("(memberOf=CN=EKSA,OU=Groups,OU=BPM,OU=OU Awam,OU=KPM,DC=modnet,DC=mindef,DC=my)") search_filters.append("(&(objectclass=person)(memberOf=CN=EKSA,OU=Groups,OU=BPM,OU=OU Awam,OU=KPM,DC=modnet,DC=mindef,DC=my))") # All done! return search_filters
def group_membership_filter(ldap_fields): group = os.environ.get('DJANGO_LDAP_GROUP_MEMBERSHIP', None) if group: ldap_fields["groupMembership"] = group search_filters = format_search_filters(ldap_fields) return search_filters
def custom_format_search_filters(ldap_fields): # custom search filter (e.g. check "memberOf" against configured value) ldap_fields[LDAP_AUTH_MEMBER_OF_ATTRIBUTE] = LDAP_AUTH_GROUP_MEMBER_OF search_filters = format_search_filters(ldap_fields) # All done! return search_filters
def custom_format_search_filters(ldap_fields): ldap_fields[ "objectCategory"] = "CN=Person,CN=Schema,CN=Configuration,DC=TESTe,DC=TESTE" search_filters = format_search_filters(ldap_fields) return search_filters
def custom_format_search_filters(ldap_fields): # Add in simple filters. ldap_fields["memberOf"] = "1.2.840.113556.1.4.1941:=CN=SpNotify,CN=Users,DC=twfp,DC=com" # Call the base format callable. search_filters = format_search_filters(ldap_fields) return search_filters