Skip to content

Commit

Permalink
Use include and set *_groups to None
Browse files Browse the repository at this point in the history
  • Loading branch information
jrdnbradford committed Oct 1, 2024
1 parent 07a6fa3 commit 6d43632
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions oauthenticator/google.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def _userdata_url_default(self):
""",
)

allow_nested_groups = Bool(
include_nested_groups = Bool(
config=True,
help="""
Include members of nested Google groups in `allowed_google_groups` and
Expand Down Expand Up @@ -383,8 +383,8 @@ def _fetch_member_groups(
member_email,
user_email_domain,
http=None,
checked_groups=set(),
processed_groups=set(),
checked_groups=None,
processed_groups=None,
):
"""
Return a set with the google groups a given user/group is a member of, including nested groups if allowed.
Expand All @@ -397,6 +397,9 @@ def _fetch_member_groups(
if not hasattr(self, 'service'):
self.service = self._setup_service(user_email_domain, http)

checked_groups = checked_groups or set()
processed_groups = processed_groups or set()

resp = self.service.groups().list(userKey=member_email).execute()
member_groups = {
g['email'].split('@')[0] for g in resp.get('groups', []) if g.get('email')
Expand All @@ -406,7 +409,7 @@ def _fetch_member_groups(
checked_groups.update(member_groups)
self.log.debug(f"Checked groups after update: {checked_groups}")

if self.allow_nested_groups:
if self.include_nested_groups:
for group in member_groups:
if group in processed_groups:
continue
Expand Down

0 comments on commit 6d43632

Please sign in to comment.