File tree Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Expand file tree Collapse file tree 2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -83,3 +83,6 @@ def _bind(password: bytes) -> "OAuthLDAPEntry":
83
83
raise LDAPInvalidCredentials (msg )
84
84
85
85
return defer .maybeDeferred (_bind , password )
86
+
87
+ def list_children (self ) -> "list[OAuthLDAPEntry]" :
88
+ return [cast (OAuthLDAPEntry , entry ) for entry in self ._children .values ()]
Original file line number Diff line number Diff line change @@ -67,15 +67,33 @@ def root(self) -> OAuthLDAPEntry:
67
67
68
68
# Add groups to the groups OU
69
69
if self .debug :
70
- log .msg (f"Adding { len (oauth_adaptor .groups )} groups to the LDAP tree." )
70
+ log .msg (
71
+ f"Attempting to add { len (oauth_adaptor .groups )} groups to the LDAP tree."
72
+ )
71
73
for group_attrs in oauth_adaptor .groups :
72
74
groups_ou .add_child (f"CN={ group_attrs .cn } " , group_attrs .to_dict ())
75
+ if self .debug :
76
+ children = groups_ou .list_children ()
77
+ for child in children :
78
+ log .msg (f"... { child .dn .getText ()} " )
79
+ log .msg (
80
+ f"There are { len (children )} groups in the LDAP tree."
81
+ )
73
82
74
83
# Add users to the users OU
75
84
if self .debug :
76
- log .msg (f"Adding { len (oauth_adaptor .users )} users to the LDAP tree." )
85
+ log .msg (
86
+ f"Attempting to add { len (oauth_adaptor .users )} users to the LDAP tree."
87
+ )
77
88
for user_attrs in oauth_adaptor .users :
78
89
users_ou .add_child (f"CN={ user_attrs .cn } " , user_attrs .to_dict ())
90
+ if self .debug :
91
+ children = users_ou .list_children ()
92
+ for child in children :
93
+ log .msg (f"... { child .dn .getText ()} " )
94
+ log .msg (
95
+ f"There are { len (children )} users in the LDAP tree."
96
+ )
79
97
80
98
# Set last updated time
81
99
log .msg ("Finished building LDAP tree." )
You can’t perform that action at this time.
0 commit comments