Users and groups#

For usage information and examples, see Users and groups

class dataikuapi.dss.admin.DSSUser(client, login)#

A handle for a user on the DSS instance.

Important

Do not instantiate directly, use dataikuapi.DSSClient.get_user() instead.

delete()#

Deletes the user

get_settings()#

Get the settings of the user.

You must use save() on the returned object to make your changes effective on the user.

Usage example

# disable some user
user = client.get_user('the_user_login')
settings = user.get_settings()
settings.enabled = False
settings.save()
Returns:

the settings of the user

Return type:

DSSUserSettings

get_activity()#

Gets the activity of the user.

Returns:

the user’s activity

Return type:

DSSUserActivity

start_resync_from_supplier()#

Starts a resync of the user from an external supplier (LDAP, Azure AD or custom auth)

Returns:

a dataikuapi.dss.future.DSSFuture representing the sync process

Return type:

dataikuapi.dss.future.DSSFuture

get_definition()#

Get the definition of the user

Caution

Deprecated, use get_settings() instead

Returns:

the user’s definition, as a dict. Notable fields are

  • login : identifier of the user, can’t be modified

  • enabled : whether the user can log into DSS

  • groups : list of group names this user belongs to

Return type:

dict

set_definition(definition)#

Set the user’s definition.

Caution

Deprecated, use dataikuapi.dss.admin.DSSUserSettings.save() instead

Important

You should only use set_definition() with an object that you obtained through get_definition(), not create a new dict.

Note

This call requires an API key with admin rights

The fields that may be changed in a user definition are:

  • email

  • displayName

  • enabled

  • groups

  • userProfile

  • password (not returned by get_definition() but can be set)

  • userProperties

  • adminProperties

  • secrets

  • credentials

Parameters:

definition (dict) – the definition for the user, as a dict

get_client_as()#

Get an API client that has the permissions of this user.

This allows administrators to impersonate actions on behalf of other users, in order to perform actions on their behalf.

Returns:

a client through which calls will be run as the user

Return type:

dataikuapi.DSSClient

class dataikuapi.dss.admin.DSSUserSettings(client, login, settings)#

Settings for a DSS user.

Important

Do not instantiate directly, use DSSUser.get_settings() instead.

property admin_properties#

Get the admin properties for this user.

Important

Do not set this property, modify the dict in place

Admin properties can be seen and modified only by administrators, not by the user themselves.

Return type:

dict

property enabled#

Whether this user is enabled.

Return type:

boolean

property creation_date#

Get the timestamp of when the user was created

Returns:

the creation date

Return type:

datetime.datetime or None

save()#

Saves the settings

add_secret(name, value)#

Add a user secret.

If there was already a secret with the same name, it is replaced

Parameters:
  • name (string) – name of the secret

  • value (string) – name of the value

get_raw()#

Get the the raw settings of the user

Modifications made to the returned object are reflected when saving.

Returns:

the dict of the settings (not a copy). Notable fields are:

  • login : identifier of the user, can’t be modified

  • enabled : whether the user can log into DSS

  • groups : list of group names this user belongs to

Return type:

dict

remove_connection_credential(connection)#

Remove per-user-credentials for a connection

If no credentials for the givent connection exists, this method does nothing

Parameters:

connection (string) – name of the connection

remove_plugin_credential(plugin_id, param_set_id, preset_id, param_name)#

Remove per-user-credentials for a plugin preset

Parameters:
  • plugin_id (string) – identifier of the plugin

  • param_set_id (string) – identifier of the parameter set to which the preset belongs

  • preset_id (string) – identifier of the preset

  • param_name (string) – name of the credentials parameter in the preset

remove_secret(name)#

Remove a user secret based on its name

If no secret of the given name exists, the method does nothing.

Parameters:

name (string) – name of the secret

set_basic_connection_credential(connection, login, password)#

Set per-user-credentials for a connection that takes a user/password pair.

Parameters:
  • connection (string) – name of the connection

  • login (string) – login of the credentials

  • password (string) – password of the credentials

set_basic_plugin_credential(plugin_id, param_set_id, preset_id, param_name, login, password)#

Set per-user-credentials for a plugin preset that takes a user/password pair

Parameters:
  • plugin_id (string) – identifier of the plugin

  • param_set_id (string) – identifier of the parameter set to which the preset belongs

  • preset_id (string) – identifier of the preset

  • param_name (string) – name of the credentials parameter in the preset

  • login (string) – login of the credentials

  • password (string) – password of the credentials

set_oauth2_plugin_credential(plugin_id, param_set_id, preset_id, param_name, refresh_token)#

Set per-user-credentials for a plugin preset that takes a OAuth refresh token

Parameters:
  • plugin_id (string) – identifier of the plugin

  • param_set_id (string) – identifier of the parameter set to which the preset belongs

  • preset_id (string) – identifier of the preset

  • param_name (string) – name of the credentials parameter in the preset

  • refresh_token (string) – value of the refresh token

property user_properties#

Get the user properties for this user.

Important

Do not set this property, modify the dict in place

User properties can be seen and modified by the user themselves. A contrario admin properties are for administrators’ eyes only.

Return type:

dict

class dataikuapi.dss.admin.DSSOwnUser(client)#

A handle to interact with your own user

Important

Do not instantiate directly, use dataikuapi.DSSClient.get_own_user() instead.

get_settings()#

Get your own settings

You must use save() on the returned object to make your changes effective on the user.

Return type:

DSSOwnUserSettings

class dataikuapi.dss.admin.DSSOwnUserSettings(client, settings)#

Settings for the current DSS user.

Important

Do not instantiate directly, use DSSOwnUser.get_settings() instead.

save()#

Saves the settings

add_secret(name, value)#

Add a user secret.

If there was already a secret with the same name, it is replaced

Parameters:
  • name (string) – name of the secret

  • value (string) – name of the value

get_raw()#

Get the the raw settings of the user

Modifications made to the returned object are reflected when saving.

Returns:

the dict of the settings (not a copy). Notable fields are:

  • login : identifier of the user, can’t be modified

  • enabled : whether the user can log into DSS

  • groups : list of group names this user belongs to

Return type:

dict

remove_connection_credential(connection)#

Remove per-user-credentials for a connection

If no credentials for the givent connection exists, this method does nothing

Parameters:

connection (string) – name of the connection

remove_plugin_credential(plugin_id, param_set_id, preset_id, param_name)#

Remove per-user-credentials for a plugin preset

Parameters:
  • plugin_id (string) – identifier of the plugin

  • param_set_id (string) – identifier of the parameter set to which the preset belongs

  • preset_id (string) – identifier of the preset

  • param_name (string) – name of the credentials parameter in the preset

remove_secret(name)#

Remove a user secret based on its name

If no secret of the given name exists, the method does nothing.

Parameters:

name (string) – name of the secret

set_basic_connection_credential(connection, login, password)#

Set per-user-credentials for a connection that takes a user/password pair.

Parameters:
  • connection (string) – name of the connection

  • login (string) – login of the credentials

  • password (string) – password of the credentials

set_basic_plugin_credential(plugin_id, param_set_id, preset_id, param_name, login, password)#

Set per-user-credentials for a plugin preset that takes a user/password pair

Parameters:
  • plugin_id (string) – identifier of the plugin

  • param_set_id (string) – identifier of the parameter set to which the preset belongs

  • preset_id (string) – identifier of the preset

  • param_name (string) – name of the credentials parameter in the preset

  • login (string) – login of the credentials

  • password (string) – password of the credentials

set_oauth2_plugin_credential(plugin_id, param_set_id, preset_id, param_name, refresh_token)#

Set per-user-credentials for a plugin preset that takes a OAuth refresh token

Parameters:
  • plugin_id (string) – identifier of the plugin

  • param_set_id (string) – identifier of the parameter set to which the preset belongs

  • preset_id (string) – identifier of the preset

  • param_name (string) – name of the credentials parameter in the preset

  • refresh_token (string) – value of the refresh token

property user_properties#

Get the user properties for this user.

Important

Do not set this property, modify the dict in place

User properties can be seen and modified by the user themselves. A contrario admin properties are for administrators’ eyes only.

Return type:

dict

class dataikuapi.dss.admin.DSSUserActivity(client, login, activity)#

Activity for a DSS user.

Important

Do not instantiate directly, use DSSUser.get_activity() or dataikuapi.DSSClient.list_users_activity() instead.

get_raw()#

Get the raw activity of the user as a dict.

Returns:

the raw activity. Fields are

  • login : the login of the user for this activity

  • lastSuccessfulLogin : timestamp in milliseconds of the last time the user logged into DSS

  • lastFailedLogin : timestamp in milliseconds of the last time DSS recorded a login failure for this user

  • lastSessionActivity : timestamp in milliseconds of the last time the user opened a tab

Return type:

dict

property last_successful_login#

Get the last successful login of the user

Returns None if there was no successful login for this user.

Returns:

the last successful login

Return type:

datetime.datetime or None

property last_failed_login#

Get the last failed login of the user

Returns None if there were no failed login for this user.

Returns:

the last failed login

Return type:

datetime.datetime or None

property last_session_activity#

Get the last session activity of the user

The last session activity is the last time the user opened a new DSS tab or refreshed his session.

Returns None if there is no session activity yet.

Returns:

the last session activity

Return type:

datetime.datetime or None

class dataikuapi.dss.admin.DSSGroup(client, name)#

A group on the DSS instance.

Important

Do not instantiate directly, use dataikuapi.DSSClient.get_group() instead.

delete()#

Deletes the group

get_definition()#

Get the group’s definition (name, description, admin abilities, type, ldap name mapping)

Returns:

the group’s definition. Top-level fields are:

  • name : name of the group

  • sourceType : type of group. Possible values: LOCAL, LDAP

Return type:

dict

set_definition(definition)#

Set the group’s definition.

Important

You should only use set_definition() with an object that you obtained through get_definition(), not create a new dict.

Parameters:

definition (dict) – the definition for the group, as a dict

class dataikuapi.dss.admin.DSSAuthorizationMatrix(authorization_matrix)#

The authorization matrix of all groups and enabled users of the DSS instance.

Important

Do not instantiate directly, use dataikuapi.DSSClient.get_authorization_matrix() instead.

property raw#

Get the raw authorization matrix as a dict

Returns:

the authorization matrix. There are 2 parts in the matrix, each as a top-level field and with similar structures, perUser and perGroup.

Return type:

dict