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

fix entitlements + instructor group

parent 949348de
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ from ..misc import get_custom_config ...@@ -10,7 +10,7 @@ from ..misc import get_custom_config
from ..orm.workshops import WorkshopShares from ..orm.workshops import WorkshopShares
def isInstructor(entitlements=[]): def isInstructor(groups=[]):
instructorGroup = ( instructorGroup = (
get_custom_config() get_custom_config()
.get("workshop", {}) .get("workshop", {})
...@@ -19,7 +19,7 @@ def isInstructor(entitlements=[]): ...@@ -19,7 +19,7 @@ def isInstructor(entitlements=[]):
"geant:dfn.de:fz-juelich.de:jsc:jupyter:workshop_instructors", "geant:dfn.de:fz-juelich.de:jsc:jupyter:workshop_instructors",
) )
) )
if instructorGroup in entitlements: if instructorGroup in groups:
return True return True
else: else:
return False return False
...@@ -32,7 +32,7 @@ class WorkshopManagerAPIHandler(APIHandler): ...@@ -32,7 +32,7 @@ class WorkshopManagerAPIHandler(APIHandler):
if not user: if not user:
raise web.HTTPError(403) raise web.HTTPError(403)
auth_state = await user.get_auth_state() 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( db_entry = WorkshopShares.find_by_workshop_id(
self.db, workshop_id=workshop_id self.db, workshop_id=workshop_id
) )
......
...@@ -11,7 +11,7 @@ from ..misc import get_custom_config ...@@ -11,7 +11,7 @@ from ..misc import get_custom_config
from ..orm.workshops import WorkshopShares from ..orm.workshops import WorkshopShares
def isInstructor(entitlements=[]): def isInstructor(groups=[]):
instructorGroup = ( instructorGroup = (
get_custom_config() get_custom_config()
.get("workshop", {}) .get("workshop", {})
...@@ -20,7 +20,7 @@ def isInstructor(entitlements=[]): ...@@ -20,7 +20,7 @@ def isInstructor(entitlements=[]):
"geant:dfn.de:fz-juelich.de:jsc:jupyter:workshop_instructors", "geant:dfn.de:fz-juelich.de:jsc:jupyter:workshop_instructors",
) )
) )
if instructorGroup in entitlements: if instructorGroup in groups:
return True return True
else: else:
return False return False
...@@ -43,7 +43,7 @@ class WorkshopManageHandler(BaseHandler): ...@@ -43,7 +43,7 @@ class WorkshopManageHandler(BaseHandler):
user=user, user=user,
auth_state=auth_state, auth_state=auth_state,
db_workshops=db_workshops, db_workshops=db_workshops,
is_instructor=isInstructor(auth_state.get("entitlements", [])), is_instructor=isInstructor(auth_state.get("groups", [])),
) )
self.finish(form) self.finish(form)
......
...@@ -121,7 +121,7 @@ class SpawnOptionsFormAPIHandler(APIHandler): ...@@ -121,7 +121,7 @@ class SpawnOptionsFormAPIHandler(APIHandler):
system = spawner.user_options.get("system") system = spawner.user_options.get("system")
account = spawner.user_options.get("hpc", {}).get("account") 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) ret = get_dropdown_lists(entitlements, system, account)
self.write(json.dumps(ret)) self.write(json.dumps(ret))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment