Skip to content
Snippets Groups Projects
Commit 21f80f08 authored by Tim Kreuzer's avatar Tim Kreuzer
Browse files

fix entitlements + instructor group

parent 949348de
Branches
Tags
No related merge requests found
......@@ -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
)
......
......@@ -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)
......
......@@ -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))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment