diff --git a/aleksis/apps/ldap/preferences.py b/aleksis/apps/ldap/preferences.py index 53f6ed332c37eaeaff9f427d8494b77ea18a34d1..1fee28579d82fe9235b7f90afb4539660e6b48d8 100644 --- a/aleksis/apps/ldap/preferences.py +++ b/aleksis/apps/ldap/preferences.py @@ -35,21 +35,6 @@ class LDAPSyncCreateMissingPersons(BooleanPreference): verbose_name = _("Create missing persons for LDAP users") -@site_preferences_registry.register -class LDAPMatchingFields(ChoicePreference): - section = ldap - name = "matching_fields" - default = "" - required = False - verbose_name = _("LDAP sync matching fields") - choices = [ - ("", "-----"), - ("match-email", _("Match only on email")), - ("match-name", _("Match only on name")), - ("match-email-name", _("Match on email and name")), - ] - - @site_preferences_registry.register class EnableLDAPGroupSync(BooleanPreference): section = ldap diff --git a/aleksis/apps/ldap/util/ldap_sync.py b/aleksis/apps/ldap/util/ldap_sync.py index e5c600abe232082d92d3e5b4bedfccae55314bff..57b890bd96f947131b8ae5f33ddb57275c4e4c6c 100644 --- a/aleksis/apps/ldap/util/ldap_sync.py +++ b/aleksis/apps/ldap/util/ldap_sync.py @@ -10,7 +10,7 @@ from django.db.models.fields.files import FileField from django.utils.text import slugify from django.utils.translation import gettext as _ -from dynamic_preferences.types import StringPreference +from dynamic_preferences.types import MultipleChoicePreference, StringPreference from tqdm import tqdm from aleksis.core.registries import site_preferences_registry @@ -101,6 +101,15 @@ def update_dynamic_preferences(): required = False default = "" + @site_preferences_registry.register + class LDAPMatchingFields(MultipleChoicePreference): + section = section_ldap + name = "matching_fields" + default = [] + required = False + verbose_name = _("LDAP sync matching fields") + choices = [("", "-----")} + [(field.name, field.name) for field in Perosn.syncable_fields()] + def apply_templates(value, patterns, templates, separator="|"): """Regex-replace patterns in value in order."""