mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-16 22:43:00 +00:00
Removed database calls and made scope filter a callable
This commit is contained in:
@@ -81,8 +81,6 @@ class BaseHandler(RequestHandler):
|
||||
The current user (None if not logged in) may be accessed
|
||||
via the `self.current_user` property during the handling of any request.
|
||||
"""
|
||||
self.raw_scopes = set()
|
||||
self.parsed_scopes = set()
|
||||
try:
|
||||
await self.get_current_user()
|
||||
except Exception:
|
||||
@@ -431,16 +429,8 @@ class BaseHandler(RequestHandler):
|
||||
# don't let errors here raise more than once
|
||||
self._jupyterhub_user = None
|
||||
self.log.exception("Error getting current user")
|
||||
self._parse_scopes()
|
||||
return self._jupyterhub_user
|
||||
|
||||
def _parse_scopes(self):
|
||||
if self._jupyterhub_user is not None or self.get_current_user_oauth_token():
|
||||
self.raw_scopes = roles.get_subscopes(*self._jupyterhub_user.roles)
|
||||
if 'all' in self.raw_scopes:
|
||||
self.raw_scopes |= scopes.get_user_scopes(self.current_user.name)
|
||||
self.parsed_scopes = scopes.parse_scopes(self.raw_scopes)
|
||||
|
||||
@property
|
||||
def current_user(self):
|
||||
"""Override .current_user accessor from tornado
|
||||
|
Reference in New Issue
Block a user