diff --git a/jsc_custom/apihandler/workshops_manage.py b/jsc_custom/apihandler/workshops_manage.py index 5f40134cd5c7a66785bf536e37ab17d8ce58df1f..757883a12b63f0e7455a5a17f4188750a639b5e4 100644 --- a/jsc_custom/apihandler/workshops_manage.py +++ b/jsc_custom/apihandler/workshops_manage.py @@ -10,7 +10,7 @@ from ..misc import get_custom_config from ..orm.workshops import WorkshopShares -def isInstructor(entitlements=[]): +def isInstructor(groups=[]): instructorGroup = ( get_custom_config() .get("workshop", {}) @@ -19,7 +19,7 @@ def isInstructor(entitlements=[]): "geant:dfn.de:fz-juelich.de:jsc:jupyter:workshop_instructors", ) ) - if instructorGroup in entitlements: + if instructorGroup in groups: return True else: return False @@ -32,7 +32,7 @@ class WorkshopManagerAPIHandler(APIHandler): if not user: raise web.HTTPError(403) auth_state = await user.get_auth_state() - if not isInstructor(auth_state.get("entitlements", [])) and workshop_id: + if not isInstructor(auth_state.get("groups", [])) and workshop_id: db_entry = WorkshopShares.find_by_workshop_id( self.db, workshop_id=workshop_id ) diff --git a/jsc_custom/handler/workshop_manage.py b/jsc_custom/handler/workshop_manage.py index 7c51ed0f6052ca6a384bb623a26959cde199df63..d3b45aafc4cad6b01f0b3bd2e6be96ac525c625d 100644 --- a/jsc_custom/handler/workshop_manage.py +++ b/jsc_custom/handler/workshop_manage.py @@ -11,7 +11,7 @@ from ..misc import get_custom_config from ..orm.workshops import WorkshopShares -def isInstructor(entitlements=[]): +def isInstructor(groups=[]): instructorGroup = ( get_custom_config() .get("workshop", {}) @@ -20,7 +20,7 @@ def isInstructor(entitlements=[]): "geant:dfn.de:fz-juelich.de:jsc:jupyter:workshop_instructors", ) ) - if instructorGroup in entitlements: + if instructorGroup in groups: return True else: return False @@ -43,7 +43,7 @@ class WorkshopManageHandler(BaseHandler): user=user, auth_state=auth_state, db_workshops=db_workshops, - is_instructor=isInstructor(auth_state.get("entitlements", [])), + is_instructor=isInstructor(auth_state.get("groups", [])), ) self.finish(form) diff --git a/jsc_custom/spawner/api_options_form.py b/jsc_custom/spawner/api_options_form.py index 7fc9c76ec9bcbccf194541af0b4bb65c5b579ccd..192b461dcb1026004c80acd014bfc83b7c872f91 100644 --- a/jsc_custom/spawner/api_options_form.py +++ b/jsc_custom/spawner/api_options_form.py @@ -121,7 +121,7 @@ class SpawnOptionsFormAPIHandler(APIHandler): system = spawner.user_options.get("system") account = spawner.user_options.get("hpc", {}).get("account") - entitlements = auth_state.get("entitlements") + entitlements = auth_state.get("oauth_user", {}).get("entitlements") ret = get_dropdown_lists(entitlements, system, account) self.write(json.dumps(ret))