Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
common-web
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
protokollsystem
common-web
Commits
6c92b00d
Commit
6c92b00d
authored
7 years ago
by
Robin Sonnabend
Browse files
Options
Downloads
Patches
Plain Diff
Enabled recursive group membership in AD
/close #144
parent
af7efaa4
Branches
Branches containing commit
Tags
v3.2.5
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
auth.py
+9
-4
9 additions, 4 deletions
auth.py
with
9 additions
and
4 deletions
auth.py
+
9
−
4
View file @
6c92b00d
...
@@ -115,12 +115,17 @@ class ADManager:
...
@@ -115,12 +115,17 @@ class ADManager:
obj_def
=
ldap3
.
ObjectDef
(
"
user
"
,
connection
)
obj_def
=
ldap3
.
ObjectDef
(
"
user
"
,
connection
)
name_filter
=
"
cn:={}
"
.
format
(
username
)
name_filter
=
"
cn:={}
"
.
format
(
username
)
user_reader
=
ldap3
.
Reader
(
connection
,
obj_def
,
self
.
user_dn
,
name_filter
)
user_reader
=
ldap3
.
Reader
(
connection
,
obj_def
,
self
.
user_dn
,
name_filter
)
group_def
=
ldap3
.
ObjectDef
(
"
group
"
,
connection
)
def
_yield_recursive_groups
(
group_dn
):
group_reader
=
ldap3
.
Reader
(
connection
,
group_def
,
group_dn
,
None
)
for
entry
in
group_reader
.
search
():
yield
entry
.
name
.
value
for
child
in
entry
.
memberOf
:
yield
from
_yield_recursive_groups
(
child
)
for
result
in
user_reader
.
search
():
for
result
in
user_reader
.
search
():
for
group_dn
in
result
.
memberOf
:
for
group_dn
in
result
.
memberOf
:
group_dn_parts
=
parse_dn
(
group_dn
)
yield
from
_yield_recursive_groups
(
group_dn
)
if
len
(
group_dn_parts
)
>=
1
:
key
,
group
,
next_char
=
group_dn_parts
[
0
]
yield
group
def
all_groups
(
self
):
def
all_groups
(
self
):
connection
=
self
.
prepare_connection
()
connection
=
self
.
prepare_connection
()
...
...
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