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
Answers
-
Alexandru Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 1,226 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-Python-Script.html#how-to-add-a-group-to-a-dataiku-dss-project-using-a-python-script
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)
-
@AlexT
we use groups to identify the difference between groups there is a specific naming convention followed for it.