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

[ENH] - Create shared directory only if group has permissions #2431

Closed
aktech opened this issue Apr 30, 2024 · 1 comment · Fixed by #2593
Closed

[ENH] - Create shared directory only if group has permissions #2431

aktech opened this issue Apr 30, 2024 · 1 comment · Fixed by #2593
Assignees
Labels
area: integration/jupyterhub needs: PR 📬 This item has been scoped and needs to be worked on project: JATIC Work item needed for the JATIC project type: enhancement 💅🏼 New feature or request

Comments

@aktech
Copy link
Member

aktech commented Apr 30, 2024

Feature description

At the moment, when a group is created in Keycloak, a shared directory is created for that group in the NFS, example:

akumar:~ 
05:04 $ ls shared/ -ltrh
total 8.0K
drwxrwxrwx 4 0 0 4.0K Feb 14 12:34 analyst
drwxrwxrwx 6 0 0 4.0K Apr 12 06:17 developer

Based on the groups the user is present in, the user have access to those.

We need to change this behaviour such that the shared directory is only created if a keycloak role with following attributes is attached to the group:

Role: create-shared-directory (name is only for example, it could be arbitrary)

Key Value
resource shared-directory
scopes write:shared

This issue is part of the permissions RFD: nebari-dev/governance#47

Notes for implementation:

  • We would need to filter groups with roles here:
  • To make this backwards compatible we need to make sure that this role is applied to default groups we currently create in Nebari
  • The edge case where a group had the above role and was later the role was removed from it: the shared directory for the same should not be removed as it could have user data and that might get lost and cause unexpected behaviour.
  • All the roles should be client specific, as in it should be part of a client like jupyterhub, grafana, conda_store, etc. In this case the role should be part of jupyterhub client. See example below (keycloak screenshot):
Screenshot 2024-04-30 at 11 27 38 am

Value and/or benefit

This gives us the ability to selectively created shared directory for keycloak groups as the user might not want to create shared directory for every group they create in keycloak.

Anything else?

No response

@aktech aktech added the type: enhancement 💅🏼 New feature or request label Apr 30, 2024
@viniciusdc viniciusdc added needs: PR 📬 This item has been scoped and needs to be worked on area: integration/jupyterhub labels May 3, 2024
@viniciusdc viniciusdc self-assigned this Jun 21, 2024
@viniciusdc viniciusdc added this to the Permission RBAC milestone Jun 21, 2024
@viniciusdc
Copy link
Contributor

Just a quick update on this.

I've finished refactoring the parser to spawner.py to handle the new role scopes for the mounts (I used the sample response shared here) and added the new roles for backward compatibility for analyst, developer, admin (I got a minor error with terraform, currently addressing it).

The only thing that needs to be added is getting the actual dict containing the roles from the Keycloak authenticator within the spawner. There is a function already present within the spawner that should allow to get the loaded_roles as part of the user metadata, I will be testing this today.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: integration/jupyterhub needs: PR 📬 This item has been scoped and needs to be worked on project: JATIC Work item needed for the JATIC project type: enhancement 💅🏼 New feature or request
Projects
2 participants