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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Mike Gabriel
AlekSIS-App-LDAP
Commits
e3cdfe3d
Verified
Commit
e3cdfe3d
authored
5 years ago
by
Tom Teichler
Browse files
Options
Downloads
Patches
Plain Diff
[Reformat] docstrings
parent
f4a8e652
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/apps/ldap/model_extensions.py
+2
-2
2 additions, 2 deletions
aleksis/apps/ldap/model_extensions.py
aleksis/apps/ldap/util/ldap_sync.py
+6
-5
6 additions, 5 deletions
aleksis/apps/ldap/util/ldap_sync.py
with
8 additions
and
7 deletions
aleksis/apps/ldap/model_extensions.py
+
2
−
2
View file @
e3cdfe3d
...
...
@@ -5,5 +5,5 @@ from jsonstore import CharField
from
aleksis.core.models
import
Group
,
Person
# Fields as import refs for LDAP objects
Group
.
field
(
ldap_dn
=
CharField
(
verbose_name
=
_
(
"
LDAP Distinguished Name
"
),
null
=
True
,
blank
=
True
))
Person
.
field
(
ldap_dn
=
CharField
(
verbose_name
=
_
(
"
LDAP Distinguished Name
"
),
null
=
True
,
blank
=
True
))
Group
.
field
(
ldap_dn
=
CharField
(
verbose_name
=
_
(
"
LDAP Distinguished Name
"
),
blank
=
True
))
Person
.
field
(
ldap_dn
=
CharField
(
verbose_name
=
_
(
"
LDAP Distinguished Name
"
),
blank
=
True
))
This diff is collapsed.
Click to expand it.
aleksis/apps/ldap/util/ldap_sync.py
+
6
−
5
View file @
e3cdfe3d
...
...
@@ -6,7 +6,7 @@ from django.apps import apps
from
django.core.files
import
File
from
django.db
import
DataError
,
IntegrityError
,
transaction
from
django.db.models
import
fields
from
django.db.models.fields.files
import
Fi
eldFile
from
django.db.models.fields.files
import
Fi
leField
from
django.utils.text
import
slugify
from
django.utils.translation
import
gettext
as
_
...
...
@@ -39,7 +39,7 @@ def ldap_field_to_filename(dn, fieldname):
def
from_ldap
(
value
,
instance
,
field
,
dn
,
ldap_field
):
"""
Convert an LDAP value to the Python type of the target field
"""
Convert an LDAP value to the Python type of the target field
.
This conversion is prone to error because LDAP deliberately breaks
standards to cope with ASN.1 limitations.
...
...
@@ -85,7 +85,8 @@ def update_dynamic_preferences():
section
=
section_ldap
name
=
setting_name
+
"
_re
"
verbose_name
=
_
(
f
"
Regular expression to match LDAP value for
{
field
.
verbose_name
}
on
{
model
.
_meta
.
label
}
against
"
f
(
"
Regular expression to match LDAP value for
"
"
{field.verbose_name} on {model._meta.label} against
"
)
)
required
=
False
default
=
""
...
...
@@ -172,7 +173,7 @@ def ldap_sync_user_on_login(sender, instance, created, **kwargs):
@transaction.atomic
def
ldap_sync_from_user
(
user
,
dn
,
attrs
):
"""
Synchronise person information from a User object (with ldap_user) to Django
"""
"""
Synchronise person information from a User object (with ldap_user) to Django
.
"""
Person
=
apps
.
get_model
(
"
core
"
,
"
Person
"
)
# Check if there is an existing person connected to the user.
...
...
@@ -296,7 +297,7 @@ def ldap_sync_from_groups(group_infos):
@transaction.atomic
def
mass_ldap_import
():
"""
U
tility code for mass import from ldap.
"""
"""
Add u
tility code for mass import from ldap.
"""
from
django_auth_ldap.backend
import
LDAPBackend
,
_LDAPUser
# noqa
Person
=
apps
.
get_model
(
"
core
"
,
"
Person
"
)
...
...
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