Coming soon: We’re working on a brand new, revamped Community experience. Want to receive updates? Sign up now!

0 votes
Would it be possible to add a code sample for setting (granting) permissions on projects for a specific group into the documentation?

Thanks
related to an answer for: Set project's security with DSS API
by

1 Answer

0 votes

Hi tomas, 

Here's an example of how this might work, the name of groups and projects is for illustration purposes.

# setting client and loading project
client = dataiku.api_client()
project = client.get_project("PROJECT_KEY")
​
# set new group as readers
project_permissions = project.get_permissions()
project_permissions['permissions'] = [{'group':'kaggle','readProjectContent': True}]
project.set_permissions(project_permissions)
​
# set another group as admin, while leaving first as readers
project_permissions = project.get_permissions()
project_permissions['permissions'] = [{'group':'kaggle','readProjectContent': True}, {'group':'recommenders','admin': True}]
project.set_permissions(project_permissions)
​
# set first group to admin, while removing the second one altogether
project_permissions = project.get_permissions()
project_permissions['permissions'] = [{'group':'kaggle','admin': True}]
project.set_permissions(project_permissions)

I hope this helps!

 

by
1,337 questions
1,364 answers
1,557 comments
11,916 users

©Dataiku 2012-2018 - Privacy Policy