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
d3f9cf64
Verified
Commit
d3f9cf64
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
74304639
de809e65
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
aleksis/apps/ldap/util/ldap_sync.py
+2
-11
2 additions, 11 deletions
aleksis/apps/ldap/util/ldap_sync.py
with
2 additions
and
11 deletions
aleksis/apps/ldap/util/ldap_sync.py
+
2
−
11
View file @
d3f9cf64
...
...
@@ -33,15 +33,6 @@ def setting_name_from_field(model, field):
return
f
"
additional_field_
{
part_1
}
_
{
field
.
name
}
"
def
syncable_fields
(
model
):
"""
Collect all fields that can be synced on a model.
"""
return
[
field
for
field
in
model
.
_meta
.
fields
if
(
field
.
editable
and
not
field
.
auto_created
and
not
field
.
is_relation
)
]
def
ldap_field_to_filename
(
dn
,
fieldname
):
"""
Generate a reproducible filename from a DN and a field name.
"""
return
f
"
{
slugify
(
dn
)
}
__
{
slugify
(
fieldname
)
}
"
...
...
@@ -78,7 +69,7 @@ def update_dynamic_preferences():
Person
=
apps
.
get_model
(
"
core
"
,
"
Person
"
)
for
model
in
(
Person
,):
# Collect fields that are matchable
for
field
in
syncable_fields
(
model
):
for
field
in
model
.
syncable_fields
():
setting_name
=
setting_name_from_field
(
model
,
field
)
@site_preferences_registry.register
...
...
@@ -216,7 +207,7 @@ def ldap_sync_from_user(user, dn, attrs):
person
.
email
=
user
.
email
# Synchronise additional fields if enabled
for
field
in
syncable_fields
(
Person
):
for
field
in
Person
.
syncable_fields
():
setting_name
=
"
ldap__
"
+
setting_name_from_field
(
Person
,
field
)
# Try sync if constance setting for this field is non-empty
...
...
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