fix(jupyterhub): check permissions before adding environment variables #212
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Even if it's not clear why the project's environment variables were included in the spawner code, the feature seems to work according to the
Manage variable
permission of GitLab (https://docs.gitlab.com/ee/user/permissions.html).Instead of removing the feature or increasing the requirement for starting JupyterLab to
Maintainer
level, it seems reasonable to keep this. The reference issue suggests to gracefully fail forDeveloper
, but this PR checks instead for the permission level to decide whether to including the variables or not. It seems a reasonable solution since this appears to be a feature used by advanced users and they should be aware of the GitLab limitations implied by the member permissions.Preview available at https://lorenzotest.dev.renku.ch
fix #210
P.S. We may also want to add a simple warning message for "non-at-least-maintainer" users in the "Notebooks Servers" tab in the UI to inform them that they may have limitations. This seems reasonable since we already discussed about relaxing the requirements to start notebooks, in which case this message would be even more useful.