Renamed configuration entries

- USER_ID_ATTRIBUTE is now USER_RDN
- GROUP_ID_ATTRIBUTE is now GROUP_RDN
This commit is contained in:
Éloi Rivard 2023-06-27 18:47:59 +02:00
parent 57af18d557
commit e4e49da44a
8 changed files with 14 additions and 14 deletions

View file

@ -244,7 +244,7 @@ def setup_ldap_models(config):
)
models.User.base = user_base
models.User.rdn_attribute = config["BACKENDS"]["LDAP"].get(
"USER_ID_ATTRIBUTE", models.User.DEFAULT_ID_ATTRIBUTE
"USER_RDN", models.User.DEFAULT_RDN
)
object_class = config["BACKENDS"]["LDAP"].get(
"USER_CLASS", models.User.DEFAULT_OBJECT_CLASS
@ -258,7 +258,7 @@ def setup_ldap_models(config):
)
models.Group.base = group_base or None
models.Group.rdn_attribute = config["BACKENDS"]["LDAP"].get(
"GROUP_ID_ATTRIBUTE", models.Group.DEFAULT_ID_ATTRIBUTE
"GROUP_RDN", models.Group.DEFAULT_RDN
)
object_class = config["BACKENDS"]["LDAP"].get(
"GROUP_CLASS", models.Group.DEFAULT_OBJECT_CLASS

View file

@ -13,7 +13,7 @@ from .ldapobject import LDAPObject
class User(canaille.core.models.User, LDAPObject):
DEFAULT_OBJECT_CLASS = "inetOrgPerson"
DEFAULT_FILTER = "(|(uid={login})(mail={login}))"
DEFAULT_ID_ATTRIBUTE = "cn"
DEFAULT_RDN = "cn"
attributes = {
"id": "dn",
@ -184,7 +184,7 @@ class User(canaille.core.models.User, LDAPObject):
class Group(canaille.core.models.Group, LDAPObject):
DEFAULT_OBJECT_CLASS = "groupOfNames"
DEFAULT_ID_ATTRIBUTE = "cn"
DEFAULT_RDN = "cn"
DEFAULT_NAME_ATTRIBUTE = "cn"
DEFAULT_USER_FILTER = "member={user.id}"

View file

@ -76,7 +76,7 @@ USER_BASE = "ou=users,dc=mydomain,dc=tld"
# USER_CLASS = "inetOrgPerson"
# The attribute to identify an object in the User dn.
# USER_ID_ATTRIBUTE = "uid"
# USER_RDN = "uid"
# Filter to match users on sign in. Supports a variable
# {login} that can be used to compare against several fields:
@ -89,7 +89,7 @@ GROUP_BASE = "ou=groups,dc=mydomain,dc=tld"
# GROUP_CLASS = "groupOfNames"
# The attribute to identify an object in the User dn.
# GROUP_ID_ATTRIBUTE = "cn"
# GROUP_RDN = "cn"
# The attribute to use to identify a group
# GROUP_NAME_ATTRIBUTE = "cn"

View file

@ -77,7 +77,7 @@ USER_BASE = "ou=users,dc=mydomain,dc=tld"
# USER_CLASS = "inetOrgPerson"
# The attribute to identify an object in the User dn.
USER_ID_ATTRIBUTE = "uid"
USER_RDN = "uid"
# Filter to match users on sign in. Supports a variable
# {login} that can be used to compare against several fields:
@ -90,7 +90,7 @@ GROUP_BASE = "ou=groups,dc=mydomain,dc=tld"
# GROUP_CLASS = "groupOfNames"
# The attribute to identify an object in the User dn.
# GROUP_ID_ATTRIBUTE = "cn"
# GROUP_RDN = "cn"
# The attribute to use to identify a group
# GROUP_NAME_ATTRIBUTE = "cn"

View file

@ -77,7 +77,7 @@ USER_BASE = "ou=users,dc=mydomain,dc=tld"
# USER_CLASS = "inetOrgPerson"
# The attribute to identify an object in the User dn.
# USER_ID_ATTRIBUTE = "uid"
# USER_RDN = "uid"
# Filter to match users on sign in. Supports a variable
# {login} that can be used to compare against several fields:
@ -90,7 +90,7 @@ GROUP_BASE = "ou=groups,dc=mydomain,dc=tld"
# GROUP_CLASS = "groupOfNames"
# The attribute to identify an object in the User dn.
# GROUP_ID_ATTRIBUTE = "cn"
# GROUP_RDN = "cn"
# The attribute to use to identify a group
# GROUP_NAME_ATTRIBUTE = "cn"

View file

@ -100,7 +100,7 @@ BACKENDS.LDAP
Can be a list of classes.
Defaults to ``inetOrgPerson``.
:USER_ID_ATTRIBUTE:
:USER_RDN:
*Optional.* The attribute to identify an object in the User DN.
For example, if it has the value ``uid``, users DN will be in the form ``uid=foobar,ou=users,dc=mydomain,dc=tld``.
Defaults to ``cn``.
@ -119,7 +119,7 @@ BACKENDS.LDAP
Can be a list of classes.
Defaults to ``groupOfNames``
:GROUP_ID_ATTRIBUTE:
:GROUP_RDN:
*Optional.* The attribute to identify an object in a group DN.
For example, if it has the value ``cn``, groups DN will be in the form ``cn=foobar,ou=users,dc=mydomain,dc=tld``.
Defaults to ``cn``

View file

@ -34,7 +34,7 @@ def ldap_configuration(configuration, slapd_server):
"BIND_DN": slapd_server.root_dn,
"BIND_PW": slapd_server.root_pw,
"USER_BASE": "ou=users",
"USER_ID_ATTRIBUTE": "uid",
"USER_RDN": "uid",
"USER_FILTER": "(uid={login})",
"GROUP_BASE": "ou=groups",
"TIMEOUT": 0.1,

View file

@ -3,7 +3,7 @@ import pytest
@pytest.fixture
def configuration(ldap_configuration):
ldap_configuration["BACKENDS"]["LDAP"]["USER_ID_ATTRIBUTE"] = "mail"
ldap_configuration["BACKENDS"]["LDAP"]["USER_RDN"] = "mail"
yield ldap_configuration