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
only show links to services users have access to #4585
only show links to services users have access to #4585
Conversation
Thanks for submitting your first pull request! You are awesome! 🤗 |
for more information, see https://pre-commit.ci
Nice! This makes sense. Before I get into detailed review, I have one question: if we filtered based on the appropriate What do you think? |
… into visibility-filters-for-services # Conflicts: # jupyterhub/handlers/base.py # jupyterhub/services/service.py
for more information, see https://pre-commit.ci
That's a good suggestion. I have adapted it to that effect. It looks cleaner and clearer that way. Is that all right? |
8679f13
to
a1a7f22
Compare
Thanks! I tidied up the check a little bit and added a test, but this looks great! |
Proposal to improve the display of services in users hub home page by using filters.
While the visibility of services can currently be enabled or disabled by the
display
value in thejupyterhub_config.py
file, there is no fine-grained control of visibility for individual users/groups or the like.The proposed code changes are intended to address this by introducing the
display_filters
attribute in the above mentioned file and corresponding adjustments inbase.py
.display_filters
is currently aDict()
with the keysusernames
,groups
androles
to filter by. It should be noted that the eventual service will only be displayed if all filters match the respective user.To implement the filtering, the function
get_accessible_services(self, user)
inbase.py
was extended by corresponding lines that (a) read the roles and group membership of the user and (b) perform the filtering and, if the attributes match, add the service to theaccessible_services
list as usual.To read the groups and roles,
roles.py
anduser.py
have been extended with the respective function/methodget_role_names_for(orm_object)
andget_groups(self)
.In our use case, we want to filter the display of a service based on a group membership, since it is necessary to show the service for certain users and hide it for others.