Skip to content

Commit

Permalink
handle manage_groups being unavailable before JupyterHub 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk committed Nov 29, 2023
1 parent ba24e02 commit a134c6c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions oauthenticator/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,11 +157,13 @@ async def update_auth_model(self, auth_model):
Also populates groups if `manage_groups` is set.
"""
if self.manage_groups or self.admin_groups:
# Authenticator.manage_groups is new in jupyterhub 2.2
manage_groups = getattr(self, "manage_groups", False)
if manage_groups or self.admin_groups:
user_info = auth_model["auth_state"][self.user_auth_state_key]
user_groups = self.get_user_groups(user_info)

if self.manage_groups:
if manage_groups:
auth_model["groups"] = user_groups

if auth_model["admin"]:
Expand Down

0 comments on commit a134c6c

Please sign in to comment.