From a134c6ced6909b271034dc32597dfc66ff89571e Mon Sep 17 00:00:00 2001 From: Min RK Date: Wed, 29 Nov 2023 12:10:54 +0100 Subject: [PATCH] handle manage_groups being unavailable before JupyterHub 2.2 --- oauthenticator/generic.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/oauthenticator/generic.py b/oauthenticator/generic.py index 14052d9e..2dce3fb3 100644 --- a/oauthenticator/generic.py +++ b/oauthenticator/generic.py @@ -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"]: