Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make profile_list union of List and Callable #192

Merged
merged 2 commits into from
Jul 3, 2018

Conversation

bitnik
Copy link

@bitnik bitnik commented Jun 20, 2018

This PR extends #137 and makes profile_list union of List and Callable.

When profile_list is defined as a callable, it can be customised according to user type or user's auth_state as @clkao already suggested.

Another possibility is that profile list can be retrieved dynamically (probably from a database table) every time user comes to 'Spawner Options' page (no need to helm upgrade every time when profile list has to be updated).

Here is a configuration example for a callable profile_list:

from tornado import gen

@gen.coroutine
def get_profile_list(spawner):
    # define profiles or retrieve from database
    ...
    # update profiles according to user data
    auth_state = yield spawner.user.get_auth_state()
    is_admin = spawner.user.admin
    ...
    return profiles
c.KubeSpawner.profile_list = get_profile_list

It would be nice to hear your opinions!

@yuvipanda yuvipanda requested a review from minrk June 27, 2018 00:16
@minrk minrk merged commit b5b2395 into jupyterhub:master Jul 3, 2018
@minrk
Copy link
Member

minrk commented Jul 3, 2018

Looks great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants