groups modfication scripts

Options
SAURABH
SAURABH Partner, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Core Concepts, Dataiku DSS Adv Designer, Registered Posts: 26 Partner
edited July 16 in Using Dataiku

Hi Team,
i there a way to modifiy a permission for mutliple groups in one go or by a script.
We have 100 groups present and we are trying to add a permission to these groups.
is there a way to complete this using a scripts.

i tried refereing the link but while modifying groups it only refers to the new group in below link https://doc.dataiku.com/dss/latest/python-api/users-groups.html#

can someone please suggest how should i modify the old/exisiting groups

even i tried the below code but it says at line 7

 'list' object has no attribute 'get_definition'


import dataiku
import prettyprinter
client = dataiku.api_client()
dss_groups = client.list_groups()
for group in dss_groups:
gname=group['name']
group_definition = dss_groups.get_definition()
group_definition['mayCreateCodeEnvs'] = True
dss_groups.set_definition(group_definition)


Operating system used: LINUX

Answers

  • Catalina
    Catalina Dataiker, Dataiku DSS Core Designer, Registered Posts: 135 Dataiker
    edited July 17
    Options

    Hi @saurabh
    ,

    The code below is an example on how to change the permission "mayCreateCodeEnvs" for all the groups:

    import dataiku
    import pprint
    
    client = dataiku.api_client()
    dict_groups = client.list_groups()
    pprint.pprint(dss_groups)
    
    for group in dict_groups:
        gname=group['name']
        dss_group = client.get_group(gname) 
        group_definition=dss_group.get_definition()
        group_definition['mayCreateCodeEnvs'] = True
        dss_group.set_definition(group_definition)
        group_definition_modified=dss_group.get_definition()
        pprint.pprint(group_definition_modified)

Setup Info
    Tags
      Help me…