Created
January 19, 2024 10:32
-
-
Save minrk/f0edc56bd55cf5c4706658cc15e0883c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def default_url(handler): | |
user = handler.current_user | |
if not user: | |
# not logged in, send to login, no ?next | |
# that way, default_url will be called again after successful login | |
return handler.get_login_url() | |
if "admin-ui" in handler.expanded_scopes: | |
# has permission to view the admin page | |
return handler.base_url + "hub/admin" | |
else: | |
# regular user, send to spawn page | |
# (which redirects to running user if it's running) | |
# this is the default default URL | |
return handler.base_url + "hub/spawn" | |
c.JupyterHub.default_url = default_url | |
c.Authenticator.allowed_users = {"admin", "testuser"} | |
c.JupyterHub.load_roles = [ | |
{ | |
"name": "admin-users", | |
"users": ["admin"], | |
"scopes": [ | |
"admin-ui", | |
"admin:users", | |
"servers", | |
], | |
}, | |
] | |
# example boilerplate | |
c.JupyterHub.authenticator_class = "dummy" | |
c.JupyterHub.spawner_class = "simple" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment