Connection security review

Solved!
Fabrice
Level 1
Connection security review

Hello,

I need to export the list of connections and the users who have access to these connections. There is an Authorization Matrix that can be exported for projects, but for connections? 

Sincerely

Fabrice


Operating system used: RedHat

0 Kudos
2 Solutions
AlexT
Dataiker

There is not such Matrix available in the UI.
You can use the Dataiku API to build something similar , not you would need to run this with Admin user:

import dataiku
import pandas as pd

# Get a list of connections
client = dataiku.api_client()
dss_connections = client.list_connections()

# Initialize lists to store the values
connection_list = []
allowed_groups_list = []

# Iterate over the connections and extract the relevant values
for connection in dss_connections:
    conn = client.get_connection(connection).get_definition()
    if conn['usableBy'] == 'ALLOWED':
        allowed_groups = conn['allowedGroups']
    else:
        allowed_groups = ["ALL"]
    connection_list.append(connection)
    allowed_groups_list.append(allowed_groups)

# Create a dataframe with the extracted values
df_connection = pd.DataFrame({
    'connection': connection_list,
    'allowed_groups': allowed_groups_list
})

# Explode the 'allowed_groups' column
df_connection = df_connection.explode('allowed_groups').reset_index(drop=True)
df_connection

 
Thanks

View solution in original post

0 Kudos
Fabrice
Level 1
Author

It's working ๐Ÿ˜‰

Thanks for your help

Fabrice

View solution in original post

0 Kudos
2 Replies
AlexT
Dataiker

There is not such Matrix available in the UI.
You can use the Dataiku API to build something similar , not you would need to run this with Admin user:

import dataiku
import pandas as pd

# Get a list of connections
client = dataiku.api_client()
dss_connections = client.list_connections()

# Initialize lists to store the values
connection_list = []
allowed_groups_list = []

# Iterate over the connections and extract the relevant values
for connection in dss_connections:
    conn = client.get_connection(connection).get_definition()
    if conn['usableBy'] == 'ALLOWED':
        allowed_groups = conn['allowedGroups']
    else:
        allowed_groups = ["ALL"]
    connection_list.append(connection)
    allowed_groups_list.append(allowed_groups)

# Create a dataframe with the extracted values
df_connection = pd.DataFrame({
    'connection': connection_list,
    'allowed_groups': allowed_groups_list
})

# Explode the 'allowed_groups' column
df_connection = df_connection.explode('allowed_groups').reset_index(drop=True)
df_connection

 
Thanks

0 Kudos
Fabrice
Level 1
Author

It's working ๐Ÿ˜‰

Thanks for your help

Fabrice

0 Kudos