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

Options
tomas
tomas Registered, Neuron 2022 Posts: 120 ✭✭✭✭✭
Would it be possible to add a code sample for setting (granting) permissions on projects for a specific group into the documentation?

Thanks
Tagged:

Answers

  • Liev
    Liev Dataiker Alumni Posts: 176 ✭✭✭✭✭✭✭✭
    Options

    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<BR />client = dataiku.api_client()<BR />project = client.get_project("PROJECT_KEY")<BR />​<BR /># set new group as readers<BR />project_permissions = project.get_permissions()<BR />project_permissions['permissions'] = [{'group':'kaggle','readProjectContent': True}]<BR />project.set_permissions(project_permissions)<BR />​<BR /># set another group as admin, while leaving first as readers<BR />project_permissions = project.get_permissions()<BR />project_permissions['permissions'] = [{'group':'kaggle','readProjectContent': True}, {'group':'recommenders','admin': True}]<BR />project.set_permissions(project_permissions)<BR />​<BR /># set first group to admin, while removing the second one altogether<BR />project_permissions = project.get_permissions()<BR />project_permissions['permissions'] = [{'group':'kaggle','admin': True}]<BR />project.set_permissions(project_permissions)<BR />

    I hope this helps!

  • falkmatt
    falkmatt Registered Posts: 1 ✭✭✭
    Options

    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!

Setup Info
    Tags
      Help me…