mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-12 04:23:01 +00:00
implement admin-access with OAuth
This commit is contained in:
@@ -503,6 +503,7 @@ class HubAuthenticated(object):
|
||||
hub_services = None # set of allowed services
|
||||
hub_users = None # set of allowed users
|
||||
hub_groups = None # set of allowed groups
|
||||
allow_admin = False # allow any admin user access
|
||||
|
||||
@property
|
||||
def allow_all(self):
|
||||
@@ -546,13 +547,17 @@ class HubAuthenticated(object):
|
||||
Returns:
|
||||
user_model (dict): The user model if the user should be allowed, None otherwise.
|
||||
"""
|
||||
|
||||
|
||||
name = model['name']
|
||||
kind = model.get('kind', 'user')
|
||||
if self.allow_all:
|
||||
app_log.debug("Allowing Hub %s %s (all Hub users and services allowed)", kind, name)
|
||||
return model
|
||||
|
||||
if self.allow_admin and model.get('admin', False):
|
||||
app_log.debug("Allowing Hub admin %s", name)
|
||||
return model
|
||||
|
||||
if kind == 'service':
|
||||
# it's a service, check hub_services
|
||||
if self.hub_services and name in self.hub_services:
|
||||
|
Reference in New Issue
Block a user