-
Notifications
You must be signed in to change notification settings - Fork 60
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
Filtered WrapSpawner #15
base: master
Are you sure you want to change the base?
Conversation
…g for parsing groups string
Update README.md for documentation on FileteredSpawner
FilteredSpawning
def get_user_groups(self): | ||
import subprocess, sys | ||
user = self.user.name | ||
cmd_result = subprocess.Popen("groups "+user, shell=True, stdout=subprocess.PIPE).stdout.read() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a safe or generic way to get groups. It assumes users are local on the Hub system, which is not generally true.
groups_list = cmd_result.decode(sys_encoding).split(':')[1].replace('\n', '').strip().split(' ') | ||
return groups_list | ||
|
||
def _user_profiles(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than implementing logic specific to your use case (filtering based on OS groups), maybe this filter should itself be a hook and then your configuration would register the appropriate filter function for your use case?
Hi everyone,
for internal purposes we had the necessity to integrate ProfileSpawner with a filter in order to provide to each user only an allowed set of profiles based on his group. We developed this feature in the FilteredSpawner class based on ProfileSpawner.
Each spawning profile has an additional parameter that allows to define a comma-separated list of authorized user groups. If * is specified instead of the comma-separated list the profile is available for all the users.
We found this integration quite useful, and we'd like to share it with the community.
Details in the README.md, let me know for any questions.
Thank you.
L.