Submit your innovative use case or inspiring success story to the 2023 Dataiku Frontrunner Awards! LET'S GO

GDPR Plugin - Project Metadata update

Solved!
NN
GDPR Plugin - Project Metadata update

Hi Team,
We have the GDPR plugin installed in our dataiku instance.
We also have a custom project creation macro in place which users use to create their projects.
https://doc.dataiku.com/dss/latest/plugins/reference/project-creation-macros.html

We were trying to see if it was feasible to update the projects GDPR metadata fields during project creation itself.
example : 

admin_client = utils.get_admin_dss_client("creation1", user_auth_info)
project_ad = admin_client.get_project(project_key)
metadata = project_ad.get_metadata()
metadata['customFields']['gdpr_forbid_dataset_sharing'] = True

 The challenge is that we have given permissions to only users who are part of the administrators group to be able to edit gdpr metadata.


And when we try to use the admin privilege api key derived during project creation to update the metadata it gives a "gdpr policies forbid you to edit metadata" error.


If anyone has tried something similar or has any suggestions on how to resolve this then please do guide.

0 Kudos
1 Solution
Moaï
Level 2

Hi !
I am sure you already found a solution, but in case somebody else would try to achieve the same thing, you can indeed take advantage of the temporary admin privileges.

admin_client = utils.get_admin_dss_client("creation1", user_auth_info)
# get a gdpr admin identity
rgpd_admin = admin_client.get_user("gdpr_admin")
rgpd_admin_client = rgpd_admin.get_client_as()
# back to your script
project_ad = rgpd_admin_client .get_project(project_key)
metadata = project_ad.get_metadata()
metadata['customFields']['gdpr_forbid_dataset_sharing'] = True

There it is !

Best regards,
Moaï

View solution in original post

0 Kudos
2 Replies
Moaï
Level 2

Hi !
I am sure you already found a solution, but in case somebody else would try to achieve the same thing, you can indeed take advantage of the temporary admin privileges.

admin_client = utils.get_admin_dss_client("creation1", user_auth_info)
# get a gdpr admin identity
rgpd_admin = admin_client.get_user("gdpr_admin")
rgpd_admin_client = rgpd_admin.get_client_as()
# back to your script
project_ad = rgpd_admin_client .get_project(project_key)
metadata = project_ad.get_metadata()
metadata['customFields']['gdpr_forbid_dataset_sharing'] = True

There it is !

Best regards,
Moaï

0 Kudos
Moaï
Level 2

 

0 Kudos