Skip to content
Snippets Groups Projects
Commit a721ff1b authored by Julian's avatar Julian
Browse files

Merge branch 'master' into ldap-orm

parents 24389d21 7bd585ca
No related branches found
No related tags found
No related merge requests found
Subproject commit e223f1617e3452d66d20b9368a74d2bdf6cc1ba4 Subproject commit 6a0b85f2c6a11951d99d4b4e84b1df992580d964
...@@ -2,11 +2,23 @@ LDAP_BASE_USER="ou=users,dc=example,dc=com" ...@@ -2,11 +2,23 @@ LDAP_BASE_USER="ou=users,dc=example,dc=com"
LDAP_BASE_GROUPS="ou=groups,dc=example,dc=com" LDAP_BASE_GROUPS="ou=groups,dc=example,dc=com"
LDAP_BASE_MAIL="ou=postfix,dc=example,dc=com" LDAP_BASE_MAIL="ou=postfix,dc=example,dc=com"
LDAP_FILTER_USER=[("objectClass","person")]
LDAP_FILTER_GROUP=[("objectClass","groupOfUniqueNames")]
LDAP_FILTER_MAIL=[("objectClass","postfixVirtual")]
LDAP_SERVICE_BIND_DN="" LDAP_SERVICE_BIND_DN=""
LDAP_SERVICE_BIND_PASSWORD="" LDAP_SERVICE_BIND_PASSWORD=""
LDAP_SERVICE_URL="ldapi:///" LDAP_SERVICE_URL="ldapi:///"
LDAP_SERVICE_USE_STARTTLS=True
LDAP_USER_OBJECTCLASSES=["top", "inetOrgPerson", "organizationalPerson", "person", "posixAccount"] LDAP_USER_OBJECTCLASSES=["top", "inetOrgPerson", "organizationalPerson", "person", "posixAccount"]
LDAP_USER_ATTRIBUTE_UID="uidNumber"
LDAP_USER_ATTRIBUTE_DISPLAYNAME="cn"
LDAP_USER_ATTRIBUTE_MAIL="mail"
# The User class gets filled by which LDAP attribute and to type (single/list)
LDAP_USER_ATTRIBUTE_EXTRA={
#"phone": {"type": "single", "name": "mobile"},
}
LDAP_USER_GID=20001 LDAP_USER_GID=20001
LDAP_USER_MIN_UID=10000 LDAP_USER_MIN_UID=10000
LDAP_USER_MAX_UID=18999 LDAP_USER_MAX_UID=18999
......
...@@ -3,7 +3,7 @@ from uffd.lazyconfig import lazyconfig_str, lazyconfig_list ...@@ -3,7 +3,7 @@ from uffd.lazyconfig import lazyconfig_str, lazyconfig_list
class Mail(ldap.Model): class Mail(ldap.Model):
ldap_search_base = lazyconfig_str('LDAP_BASE_MAIL') ldap_search_base = lazyconfig_str('LDAP_BASE_MAIL')
ldap_filter_params = (('objectClass', 'postfixVirtual'),) ldap_filter_params = lazyconfig_list('LDAP_FILTER_MAIL')
ldap_object_classes = lazyconfig_list('MAIL_LDAP_OBJECTCLASSES') ldap_object_classes = lazyconfig_list('MAIL_LDAP_OBJECTCLASSES')
ldap_dn_attribute = 'uid' ldap_dn_attribute = 'uid'
ldap_dn_base = lazyconfig_str('LDAP_BASE_MAIL') ldap_dn_base = lazyconfig_str('LDAP_BASE_MAIL')
......
...@@ -19,15 +19,15 @@ def get_next_uid(): ...@@ -19,15 +19,15 @@ def get_next_uid():
class User(ldap.Model): class User(ldap.Model):
ldap_search_base = lazyconfig_str('LDAP_BASE_USER') ldap_search_base = lazyconfig_str('LDAP_BASE_USER')
ldap_filter_params = (('objectClass', 'person'),) ldap_filter_params = lazyconfig_list('LDAP_FILTER_USER')
ldap_object_classes = lazyconfig_list('LDAP_USER_OBJECTCLASSES') ldap_object_classes = lazyconfig_list('LDAP_USER_OBJECTCLASSES')
ldap_dn_base = lazyconfig_str('LDAP_BASE_USER') ldap_dn_base = lazyconfig_str('LDAP_BASE_USER')
ldap_dn_attribute = 'uid' ldap_dn_attribute = 'uid'
uid = ldap.Attribute('uidNumber', default=get_next_uid) uid = ldap.Attribute(lazyconfig_str('LDAP_USER_ATTRIBUTE_UID'), default=get_next_uid)
loginname = ldap.Attribute('uid') loginname = ldap.Attribute('uid')
displayname = ldap.Attribute('cn', aliases=['givenName', 'displayName']) displayname = ldap.Attribute(lazyconfig_str('LDAP_USER_ATTRIBUTE_DISPLAYNAME'), aliases=['givenName', 'displayName'])
mail = ldap.Attribute('mail') mail = ldap.Attribute(lazyconfig_str('LDAP_USER_ATTRIBUTE_MAIL'))
pwhash = ldap.Attribute('userPassword', default=lambda: hashed(HASHED_SALTED_SHA512, secrets.token_hex(128))) pwhash = ldap.Attribute('userPassword', default=lambda: hashed(HASHED_SALTED_SHA512, secrets.token_hex(128)))
groups = [] # Shuts up pylint, overwritten by back-reference groups = [] # Shuts up pylint, overwritten by back-reference
...@@ -103,7 +103,7 @@ class User(ldap.Model): ...@@ -103,7 +103,7 @@ class User(ldap.Model):
class Group(ldap.Model): class Group(ldap.Model):
ldap_search_base = lazyconfig_str('LDAP_BASE_GROUPS') ldap_search_base = lazyconfig_str('LDAP_BASE_GROUPS')
ldap_filter_params = (('objectClass', 'groupOfUniqueNames'),) ldap_filter_params = lazyconfig_list('LDAP_FILTER_GROUP')
gid = ldap.Attribute('gidNumber') gid = ldap.Attribute('gidNumber')
name = ldap.Attribute('cn') name = ldap.Attribute('cn')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment