Survey banner
The Dataiku Community is moving to a new home! Some short term disruption starting next week: LEARN MORE

Is it possible to see the list of member of a group in the UI?

ecerulm
Level 4
Is it possible to see the list of member of a group in the UI?


I want to find out who are the members of a given group , how do I do that? 

In the  DSS > Administration > Security > Users, I can see each user and the groups they belong to, but that will require me to go user by user , looking if they are in a group or not. 


DSS > Administration > Security > Groups > doesn't seem to show the member of each group. 

 

I looked into dsscli but I can't find a command there to show the members of a given group,

 

I guess I could use the REST API to list all users, get the info of each user, and compute the group membership myself but is that really the only option that I have? 

 

 

 

0 Kudos
4 Replies
MiguelangelC
Dataiker

Hi,

You can indeed use the DSS Python API to get this information and format it to your business requirements.

Nevertheless, from the DSS UI you can filter the users list based on group names. See for example:
Capture.PNG

0 Kudos
Turribeach

Run this on a Jupyter Notebook and you can download a CSV with all your users and their groups:

 

import dataiku
import pandas as pd, numpy as np
from dataiku import pandasutils as pdu
import base64
from IPython.display import display, HTML
client = dataiku.api_client()
users_list = client.list_users()

df_user_groups = pd.DataFrame(columns=['user_id', 'group_name'])

for user in users_list:
    for group in user['groups']:
        data_record =  pd.DataFrame.from_dict({'user_id': [user['login']], 'group_name': [group]})
        df_user_groups = pd.concat([df_user_groups, data_record], ignore_index=True)
        
def create_download_link( df, title = "Download CSV file", filename = "dataiku_user_groups.csv"):
    csv = df.to_csv()
    b64 = base64.b64encode(csv.encode())
    payload = b64.decode()
    html = '<a download="{filename}" href="data&colon;text/csv;base64,{payload}" target="_blank">{title}</a>'
    html = html.format(payload=payload,title=title,filename=filename)
    return HTML(html)

create_download_link(df_user_groups)

 

Add to a Python recipe and you can create a dataset with it for easy exploring. You could also create a WebApp that displays them. 

 

 

 

0 Kudos
marwa
Level 1

i tried this code , but have this error :

name 'HTML' is not defined

0 Kudos
Turribeach

My bad, it was missing an import, added it now:

from IPython.display import display, HTML

 

0 Kudos