mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-19 07:53:00 +00:00
fixed scope test attr error for older_requirements.txt test
This commit is contained in:
@@ -217,7 +217,7 @@ def switch_default_role(db, obj, kind, admin):
|
|||||||
def update_roles(db, obj, kind, roles=None):
|
def update_roles(db, obj, kind, roles=None):
|
||||||
|
|
||||||
"""Updates object's roles if specified,
|
"""Updates object's roles if specified,
|
||||||
assigns default if no roles specified"""
|
assigns default if no roles specified"""
|
||||||
|
|
||||||
Class = get_orm_class(kind)
|
Class = get_orm_class(kind)
|
||||||
user_role = orm.Role.find(db, 'user')
|
user_role = orm.Role.find(db, 'user')
|
||||||
|
@@ -406,9 +406,15 @@ def needs_scope(scope):
|
|||||||
if check_scope(self, scope, parsed_scopes, **s_kwargs):
|
if check_scope(self, scope, parsed_scopes, **s_kwargs):
|
||||||
return func(self, *args, **kwargs)
|
return func(self, *args, **kwargs)
|
||||||
else:
|
else:
|
||||||
|
# catching attr error occurring for older_requirements test
|
||||||
|
# could be done more ellegantly?
|
||||||
|
try:
|
||||||
|
request_path = self.request.path
|
||||||
|
except AttributeError:
|
||||||
|
request_path = 'the requested API'
|
||||||
app_log.warning(
|
app_log.warning(
|
||||||
"Not authorizing access to {}. Requires scope {}, not derived from scopes {}".format(
|
"Not authorizing access to {}. Requires scope {}, not derived from scopes {}".format(
|
||||||
self.request.path, scope, ", ".join(self.scopes)
|
request_path, scope, ", ".join(self.scopes)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
raise web.HTTPError(
|
raise web.HTTPError(
|
||||||
|
Reference in New Issue
Block a user