Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-App-LDAP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-App-LDAP
Commits
add547e5
Verified
Commit
add547e5
authored
4 years ago
by
Nik | Klampfradler
Browse files
Options
Downloads
Patches
Plain Diff
Dynamically generate LDAPMatchingFields preference
parent
a6be0405
No related branches found
No related tags found
1 merge request
!28
Resolve "Allow match of users to persons by other fields in AlekSIS and LDAP"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/ldap/preferences.py
+0
-15
0 additions, 15 deletions
aleksis/apps/ldap/preferences.py
aleksis/apps/ldap/util/ldap_sync.py
+10
-1
10 additions, 1 deletion
aleksis/apps/ldap/util/ldap_sync.py
with
10 additions
and
16 deletions
aleksis/apps/ldap/preferences.py
+
0
−
15
View file @
add547e5
...
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
aleksis/apps/ldap/util/ldap_sync.py
+
10
−
1
View file @
add547e5
...
...
@@ -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.
"""
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment