From 48455c60233ff3ec261572d7ac2322d339a4c140 Mon Sep 17 00:00:00 2001 From: James Robinson Date: Tue, 21 May 2024 13:48:37 +0100 Subject: [PATCH] :loud_sound: Add additional debug messages for user and group membership --- apricot/oauth/oauth_data_adaptor.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/apricot/oauth/oauth_data_adaptor.py b/apricot/oauth/oauth_data_adaptor.py index 701e55a..2263af5 100644 --- a/apricot/oauth/oauth_data_adaptor.py +++ b/apricot/oauth/oauth_data_adaptor.py @@ -128,6 +128,11 @@ def _retrieve_entries( for parent_dict in oauth_groups + user_primary_groups + groups_of_groups if child_dn in parent_dict["member"] ] + if self.debug: + for group_name in child_dict["memberOf"]: + log.msg( + f"... user '{child_dict['cn']}' is a member of '{group_name}'" + ) # Ensure memberOf is set correctly for groups for child_dict in oauth_groups + user_primary_groups + groups_of_groups: @@ -137,6 +142,11 @@ def _retrieve_entries( for parent_dict in oauth_groups + user_primary_groups + groups_of_groups if child_dn in parent_dict["member"] ] + if self.debug: + for group_name in child_dict["memberOf"]: + log.msg( + f"... group '{child_dict['cn']}' is a member of '{group_name}'" + ) # Annotate group and user dicts with the appropriate LDAP classes annotated_groups = [