The Dataiku Frontrunner Awards have just launched to recognize your achievements! Submit Your Entry

Code sample for setting (granting) permissions on projects for a specific group

tomas
Level 5
Code sample for setting (granting) permissions on projects for a specific group
Would it be possible to add a code sample for setting (granting) permissions on projects for a specific group into the documentation?

Thanks
0 Kudos
2 Replies
Liev
Dataiker
Dataiker

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!



 

falkmatt
Level 1

Hi team, 

does such a code snippet also exist for instance level permissions, such as described here in the documentation?  The background is that I want to automate group level permissions when creating a DSS instance. 

Thanks in advance!

0 Kudos
Labels (2)
A banner prompting to get Dataiku DSS