listing project and modifying security for it

Srkanoje
Level 3
listing project and modifying security for it

Hi all,

i have a instance were have more than 50 projects present which have been used by 2 different teams, so i want to export the project key for a specific team and modify the  security settings.

can someone please suggest a code which can help to do both the thing in one go : 
1) fetching the project keys for specific team 
2) modifying security for the listed project.


Operating system used: linux

0 Kudos
2 Replies
AlexT
Dataiker

Hi @Srkanoje ,

What criteria would you use to determine if a project belongs to a specific team?

To check permissions or modify permissions via the API you can use :

get_permissions() and set_permissions()

PLease see examples here : https://knowledge.dataiku.com/latest/kb/code/python/How-to-add-a-group-to-a-DSS-Project-using-a-Pyth...

To loop trough all projects and find project where specific group has any permissions you can use something like this. 

import dataiku
client = dataiku.api_client()

for p in client.list_project_keys():
    proj = client.get_project(p)
    perm = proj.get_permissions()
    settings = proj.get_settings()
    
    permissions = perm['permissions']
    for i in permissions:
            if i.get("group") == 'data_team':
                print(p)

 

0 Kudos
Srkanoje
Level 3
Author

@AlexT we use groups to identify the difference between groups there is a specific naming convention followed for it.

0 Kudos