Placeholder for roles in spawner

This commit is contained in:
0mar
2021-04-23 09:46:42 +02:00
parent a5af48ef24
commit cb8c02366d
2 changed files with 4 additions and 2 deletions

View File

@@ -587,7 +587,7 @@ class JupyterHubOAuthServer(WebApplicationServer):
super().__init__(validator, *args, **kwargs) super().__init__(validator, *args, **kwargs)
def add_client( def add_client(
self, client_id, client_secret, redirect_uri, allowed_roles, description='' self, client_id, client_secret, redirect_uri, allowed_roles=None, description=''
): ):
"""Add a client """Add a client
@@ -609,6 +609,8 @@ class JupyterHubOAuthServer(WebApplicationServer):
app_log.info(f'Creating oauth client {client_id}') app_log.info(f'Creating oauth client {client_id}')
else: else:
app_log.info(f'Updating oauth client {client_id}') app_log.info(f'Updating oauth client {client_id}')
if allowed_roles == None:
allowed_roles = []
orm_client.secret = hash_token(client_secret) if client_secret else "" orm_client.secret = hash_token(client_secret) if client_secret else ""
orm_client.redirect_uri = redirect_uri orm_client.redirect_uri = redirect_uri
orm_client.description = description orm_client.description = description

View File

@@ -568,7 +568,7 @@ class User:
client_id, client_id,
api_token, api_token,
url_path_join(self.url, server_name, 'oauth_callback'), url_path_join(self.url, server_name, 'oauth_callback'),
description="Server at %s" description="Server at %s" # todo: own server: 'users:servers!user={username} as allowed role?
% (url_path_join(self.base_url, server_name) + '/'), % (url_path_join(self.base_url, server_name) + '/'),
) )
db.commit() db.commit()