mstrio.users_and_groups package

Submodules

mstrio.users_and_groups.contact module

class mstrio.users_and_groups.contact.Contact(connection: Connection, id: str | None = None, name: str | None = None)

Bases: EntityBase, DeleteMixin

Object representation of Microstrategy Contact object

name

contact’s name

id

contact’s id

description

contact’s description

enabled

specifies if a contact is enabled

linked_user

user linked to contact, instance of User

contact_addresses

list of contact’s addresses, instances of ContactAddress

memberships

list of Contact Groups that the contact belongs to

connection

instance of Connection class, represents connection to MicroStrategy Intelligence Server

add_to_contact_group(contact_group: mstrio.users_and_groups.contact_group.ContactGroup | str)

Add to ContactGroup

Parameters:

contact_group – contact group to which add this contact

alter(name: str | None = None, description: str | None = None, enabled: bool | None = None, linked_user: Optional[Union[User, str]] = None, contact_addresses: collections.abc.Iterable[mstrio.users_and_groups.contact.ContactAddress | dict] | None = None)

Update properties of a contact

Parameters:
  • name – name of a contact

  • description – description of a contact

  • enabled – specifies if a contact is enabled

  • linked_user – an object of class User linked to the contact

  • contact_addresses – list of contact addresses

classmethod create(connection: Connection, name: str, linked_user: User | str, contact_addresses: Iterable[ContactAddress | dict], description: str | None = None, enabled: bool = True) Contact

Create a new contact.

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection()

  • name – contact name

  • linked_user – user linked to contact

  • contact_addresses – list of contact addresses

  • description – description of contact

  • enabled – specifies if contact should be enabled

Returns:

Contact object

remove_from_contact_group(contact_group: mstrio.users_and_groups.contact_group.ContactGroup | str)

Remove from ContactGroup

Parameters:

contact_group – contact group from which to remove this contact

class mstrio.users_and_groups.contact.ContactAddress(name: str, physical_address: str, delivery_type: mstrio.users_and_groups.contact.ContactDeliveryType | str, device: Device | str, id: str | None = None, is_default: bool = False, connection: Optional[Connection] = None)

Bases: Dictable

Representation of contact address object

id

id of contact address, optional

name

contact address’ name

physical_address

physical address of contact

delivery_type

object of type ContactDeliveryType

is_default

specifies if address is default, optional, default value: False

device

instance of Device or string (containing device’s id), if device is a string, connection is required

connection

instance of Connection, optional, is required if device is string

classmethod from_dict(source, connection, to_snake_case=True) ContactAddress

Creates an object from a dictionary. The dictionary’s keys in camel case are changed to object’s attribute names (by default in snake case) and dict values are composed to their proper data types such as Enums, list of Enums etc. as specified in _FROM_DICT_MAP.

Parameters:
  • cls (T) – Class (type) of an object that should be created.

  • source (Dict[str, Any]) – A dictionary from which an object will be constructed.

  • connection (Connection, optional) – A MSTR Connection object. Defaults to None.

  • to_snake_case (bool, optional) – Set to True if attribute names should be converted from camel case to snake case. Defaults to True.

  • with_missing_value – (bool, optional): If True, class attributes possible to fetch and missing in source will be set as MissingValue objects.

Returns:

An object of type T.

Return type:

T

to_dict(camel_case=True) dict

Converts an object to a dictionary excluding object’s private properties. When converting the object to a dictionary, the object’s attributes become the dictionary’s keys and are in camel case by default Attribute values stored as objects are automatically converted to non-/ primitive data structures.

Parameters:

camel_case (bool, optional) – Set to True if attribute names should be converted from snake case to camel case. Defaults to True.

Returns:

A dictionary representation of object’s attributes and values.

By default, the dictionary keys are in camel case.

Return type:

dict

class mstrio.users_and_groups.contact.ContactDeliveryType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

EMAIL = 'email'
FILE = 'file'
FTP = 'ftp'
MOBILE_ANDROID = 'mobile_android'
MOBILE_IPAD = 'mobile_ipad'
MOBILE_IPHONE = 'mobile_iphone'
PRINTER = 'printer'
UNSUPPORTED = 'unsupported'
mstrio.users_and_groups.contact.list_contacts(connection: Connection, to_dictionary: bool = False, limit: int | None = None, **filters) list['Contact'] | list[dict]

Get all contacts as list of Contact objects or dictionaries.

Optionally filter the contacts by specifying filters.

Parameters:
  • connection – MicroStrategy connection object

  • to_dictionary – If True returns a list of contact dicts, otherwise returns a list of contact objects

  • limit – limit the number of elements returned. If None (default), all objects are returned.

  • **filters – Available filter parameters: [‘id’, ‘name’, ‘description’, ‘enabled’, ‘linked_user’]

mstrio.users_and_groups.contact_group module

class mstrio.users_and_groups.contact_group.ContactGroup(connection: Connection, id: str | None = None, name: str | None = None)

Bases: EntityBase, DeleteMixin

Object representation of Microstrategy Contact Group object

name

contact group’s name

id

contact group’s id

description

contact group’s description

enabled

specifies if a contact group is enabled

linked_user

user linked to contact group, instance of User

members

list of contact group’s members, instances of ContactGroupMember

memberships

list of Contact Groups that the Contact Group belongs to

connection

instance of Connection class, represents connection to MicroStrategy Intelligence Server

add_members(members: Iterable[Union[ContactGroupMember, Contact, ContactGroup]])

Add member

Parameters:

members – list of members to add to contact group

alter(name: str | None = None, description: str | None = None, enabled: bool | None = None, linked_user: Optional[Union[User, str]] = None, members: collections.abc.Iterable[Union[mstrio.users_and_groups.contact_group.ContactGroupMember, dict]] | None = None)

Update properties of a contact group

Parameters:
  • name – name of a contact

  • description – description of a contact

  • enabled – specifies if a contact is enabled

  • linked_user – an object of class User linked to the contact

  • members – list of contact group members, instances of ContactGroupMember

classmethod create(connection: Connection, name: str, linked_user: str | mstrio.users_and_groups.user.User, members: list[dict | mstrio.users_and_groups.contact_group.ContactGroupMember], description: str | None = None, enabled: bool = True) ContactGroup

Create a new contact group.

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection()

  • name – contact group name

  • linked_user – user linked to contact

  • members – list of members

  • description – description of contact

  • enabled – specifies if contact should be enabled

Returns:

ContactGroup object

remove_members(members: Iterable[Union[ContactGroupMember, Contact, ContactGroup]])

Remove member

Parameters:

members – list of members to remove from contact group

class mstrio.users_and_groups.contact_group.ContactGroupMember(name: str, type: str | mstrio.users_and_groups.contact_group.ContactGroupMemberType, id: str | None = None, description: str | None = None, enabled: bool = True)

Bases: Dictable

ContactGroupMember class, representing either Contact or ContactGroup

name

member’s name

type

type of a member, instance of ContactGroupMemberType

id

id of member, optional

description

member’s description, optional

enabled

specifies if a member is enabled

classmethod from_contact_or_contact_group(obj: Union[Contact, ContactGroup]) ContactGroupMember

Initialize instance of class ContactGroupMember

Parameters:
  • obj – object to used as base for initializing instance of

  • ContactGroupMember

Returns:

ContactGroupMember object

class mstrio.users_and_groups.contact_group.ContactGroupMemberType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: AutoName

CONTACT = 'contact'
CONTACT_GROUP = 'contact_group'
USER = 'user'
mstrio.users_and_groups.contact_group.list_contact_groups(connection: Connection, to_dictionary: bool = False, limit: int | None = None, **filters) list['ContactGroup'] | list[dict]

Get all contact groups as list of ContactGroup objects or dictionaries.

Optionally filter the contact groups by specifying filters.

Parameters:
  • connection (object) – MicroStrategy connection object

  • to_dictionary – If True returns a list of contact group dicts, otherwise returns a list of contact group objects

  • limit – limit the number of elements returned. If None (default), all objects are returned.

  • **filters – Available filter parameters: [‘id’, ‘name’, ‘description’, ‘enabled’, ‘linked_user’]

mstrio.users_and_groups.user module

class mstrio.users_and_groups.user.User(connection: Connection, username: str | None = None, name: str | None = None, id: str | None = None)

Bases: Entity, DeleteMixin, TrusteeACLMixin, TranslationMixin

Object representation of MicroStrategy User object.

connection

A MicroStrategy connection object

id

User ID

name

User name

username

User username

full_name

full name of the User

initials

User initials, derived from user’s last name or username

abbreviation

User login name

description

User description

memberships

IDs and names of direct parent groups for user

security_roles

security roles that the user is a member of

addresses

addresses for the user

privileges

user privileges per project

trust_id

Unique user ID provided by trusted authentication provider

enabled

Specifies if user is allowed to log in

owner

owner ID and name

ancestors

List of ancestor folders

password_modifiable

If user password can be modified

password_auto_expire

If user password is set to auto expire

password_expiration_date

Date when User password expires

password_expiration_frequency

Frequency of password expiration in days

require_new_password

If user is required to change new password

standard_auth

If standard authentication is allowed for user

ldapdn

information about user’s LDAP distinguished name

date_created

Creation time, DateTime object

date_modified

Last modification time, DateTime object

type

Object type

subtype

Object subtype

ext_type

Object extended type

version

Version ID

acg

Access rights (See EnumDSSXMLAccessRightFlags for possible values)

acl

Object access control list

default_timezone

Information about user default timezone

language

Information about user language

add_address(name: str | None = None, address: str | None = None, default: bool = True, delivery_type: str | None = None, device_id: str | None = None) None

Add new address to the user object.

Parameters:
  • name (str) – User-specified name for the address

  • address (str) – The actual value of the address i.e. email address associated with this address name/id

  • default (bool, optional) – Specifies whether this address is the default address (change isDefault parameter). Default value is set to True.

  • delivery_type (str, optional) – Delivery type

  • device_id (str, optional) – Device ID

add_to_user_groups(user_groups: str | UserGroup | list[str | UserGroup]) None

Adds this User to user groups specified in user_groups.

Parameters:

user_groups – list of UserGroup objects or IDs

alter(username: str | None = None, full_name: str | None = None, description: str | None = None, password: str | None = None, enabled: bool | None = None, password_modifiable: bool | None = None, password_auto_expire: bool | None = None, password_expiration_date: str | None = None, password_expiration_frequency: str | None = None, standard_auth: bool | None = None, require_new_password: bool | None = None, ldapdn: str | None = None, trust_id: str | None = None, database_auth_login: str | None = None, owner: mstrio.users_and_groups.user.User | str | None = None, default_timezone: str | dict | None = None, language: str | mstrio.server.language.Language | None = None, comments: str | None = None) None

Alter user properties.

Parameters:
  • username – username of user

  • full_name – user full name

  • description – user description

  • password – user password

  • enabled – specifies if user is allowed to log in

  • password_modifiable – Specifies if user password can be modified

  • password_auto_expire – specifies if password will expire automatically

  • password_expiration_date – Expiration date of user password, “yyyy-MM-dd HH:mm:ss” in UTC

  • password_expiration_frequency – frequency of password expiration specified in days

  • standard_auth – Specifies whether standard authentication is allowed for user.

  • require_new_password – Specifies if user is required to provide a new password.

  • ldapdn – User’s LDAP distinguished name

  • trust_id – Unique user ID provided by trusted authentication provider

  • database_auth_login – Database Authentication Login

  • owner – owner of user

  • default_timezone – default timezone for user

  • language – language for user

  • comments – long description of the object

apply_security_filter(security_filter: SecurityFilter | str) bool

Apply a security filter to the user.

Parameters:

security_filter (string or object) – identifier of security filter or SecurityFilter object which will be applied to the user.

Returns:

True when applying was successful. False otherwise.

assign_security_role(security_role: mstrio.access_and_security.security_role.SecurityRole | str, project: Project | str) None

Assigns a Security Role to the user for given project.

Parameters:
  • security_role – Security Role ID or object

  • project – Project name or object

classmethod create(connection: Connection, username: str, full_name: str, password: str | None = None, description: str | None = None, enabled: bool = True, password_modifiable: bool = True, password_auto_expire: bool | None = None, password_expiration_date: str | datetime.datetime | None = None, password_expiration_frequency: int | None = None, require_new_password: bool = True, standard_auth: bool = True, ldapdn: str | None = None, trust_id: str | None = None, database_auth_login: str | None = None, memberships: list | None = None, language: str | mstrio.server.language.Language | None = None, default_timezone: str | dict | None = None, owner: mstrio.users_and_groups.user.User | str | None = None) User

Create a new user on the I-Server. Returns User object.

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection()

  • username – username of user

  • full_name – user full name

  • password – user password

  • description – user description

  • enabled – specifies if user is allowed to log in

  • password_modifiable – Specifies if user password can be modified

  • password_auto_expire – specifies if password will expire automatically

  • password_expiration_date – Expiration date of user password either as a datetime or string: “yyyy-MM-dd HH:mm:ss” in UTC

  • password_expiration_frequency – frequency of password expiration specified in days

  • require_new_password – Specifies if user is required to provide a new password.

  • standard_auth – Specifies whether standard authentication is allowed for user.

  • ldapdn – User’s LDAP distinguished name

  • trust_id – Unique user ID provided by trusted authentication provider

  • database_auth_login – Database Authentication Login

  • memberships – specify User Group IDs which User will be member off.

  • owner – owner of user

  • default_timezone – default timezone for user

  • language – language for user

delete(force: bool = False) bool

Deletes the user. Deleting the user will not remove the user’s shared files.

Args:

force: If True, no additional prompt will be shown before deleting

User.

Returns:

True for success. False otherwise.

disconnect(nodes: str | list[str] | None = None) None

Disconnect all active user connection sessions for the specified node.

Parameters:

nodes – list of node names

grant_privilege(privilege: str | list[str] | Privilege | list[Privilege]) None

Grant privileges directly to the user.

Parameters:

privilege – list of privilege objects, ids or names

list_privileges(mode: mstrio.access_and_security.privilege_mode.PrivilegeMode | str = PrivilegeMode.ALL, to_dataframe: bool = False) list

List privileges for user.

Parameters:
  • mode – Filter by source of privileges. One of: ALL, INHERITED, or GRANTED. See: privilege.PrivilegeMode enum.

  • to_dataframe – If True, return a DataFrame object containing privileges.

list_security_filters(projects: str | list[str] | None = None, to_dictionary: bool = False) dict

Get the list of security filters for user. They can be filtered by the projects’ ids.

Parameters:
  • projects (str or list of str, optional) – collection of projects’ ids which is used for filtering data

  • to_dictionary – If True returns security filters as dicts, by default (False) returns them as objects.

Returns:

Dictionary with project names as keys and list with security filters as values. In case of no security filter for the given user in the particular project, then this project is not placed in the dictionary.

remove_address(name: str | None = None, address: str | None = None, id: str | None = None) None

Remove existing address from the user object. Specify either address ID or name. Warning, address names are not unique and can potentially remove multiple addresses.

Parameters:
  • name – User-specified name for the address

  • address – The actual value of the address i.e. email address associated with this address name/id

  • id – ID of the address.

remove_from_all_user_groups() None

Removes this User from all user groups.

remove_from_user_groups(user_groups: str | UserGroup | list[str | UserGroup]) None

Removes this User from user groups specified in user_groups.

Parameters:

user_groups – list of UserGroup objects or IDs

revoke_all_privileges(force: bool = False) None

Revoke directly granted user privileges.

Parameters:

force – If True, no additional prompt will be shown before revoking all privileges from User.

revoke_privilege(privilege: str | list[str] | Privilege | list[Privilege]) None

Revoke directly granted user privileges.

Parameters:

privilege – list of privilege objects, ids or names

revoke_security_filter(security_filter: SecurityFilter | str) bool

Revoke a security filter from the user.

Parameters:

security_filter (string or object) – identifier of security filter or SecurityFilter object which will be revoked from the user.

Returns:

True when revoking was successful. False otherwise.

revoke_security_role(security_role: mstrio.access_and_security.security_role.SecurityRole | str, project: Project | str) None

Removes a Security Role from the user for given project.

Parameters:
  • security_role – Security Role ID or object

  • project – Project name or object

classmethod to_csv_from_list(objects: list[mstrio.users_and_groups.user.User], path: str | None = None, properties: list[str] | None = None) str | None

Exports list of user objects to csv (if path is provided) or to string (if path is not provided). The properties that are lists, dictionaries, or objects of custom classes, are first converted to dictionary using to_dict() method, then serialized string as json.

Parameters:
  • objects (list) – list of user objects to be exported

  • path (str, optional) – a path specifying where to save the csv file

  • properties (list, optional) – list of properties of user object to be exported

Returns: str or None

Raises:

TypeError if objects parameter contains objects other than – of type User

classmethod to_datafame_from_list(objects: list[mstrio.users_and_groups.user.User], properties: list[str] | None = None) DataFrame

Exports list of user objects to dataframe. The properties that are lists, dictionaries, or objects of custom classes, are first converted to dictionary using to_dict() method, then serialized string as json.

Parameters:
  • objects (list) – list of user objects to be exported

  • properties (list, optional) – list of properties of user object to be exported

Returns: dataframe

Raises:

TypeError if objects parameter contains objects other than – of type User

update_address(id: str, name: str | None = None, address: str | None = None, default: bool | None = None, delivery_type: str | None = None, device_id: str | None = None) None

Update existing address. The address ID has to be specified as the name is not unique.

Parameters:
  • id (str) – ID of the address

  • name (str, optional) – New user-specified name for the address

  • address (str, optional) – New address value

  • default (bool, optional) – Whether the address should be (un)marked as default

  • delivery_type (str, optional) – Delivery type

  • device_id (str, optional) – Device ID

mstrio.users_and_groups.user.create_users_from_csv(connection: Connection, csv_file: str) list[mstrio.users_and_groups.user.User]

Create new user objects from csv file. Possible header values for the users are the same as in the User.create() method.

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection()

  • csv_file – path to file containing at minimum ‘username’ and ‘full_name’ headers’.

mstrio.users_and_groups.user.list_users(connection: Connection, name_begins: str | None = None, abbreviation_begins: str | None = None, to_dictionary: bool = False, limit: int | None = None, **filters) list[mstrio.users_and_groups.user.User] | list[dict]

Get list of user objects or user dicts. Optionally filter the users by specifying ‘name_begins’, ‘abbreviation_begins’ or other filters.

Wildcards available for name_begins and abbreviation_begins:

? - any character * - 0 or more of any characters e.g. name_begins = ?onny will return Sonny and Tonny

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection()

  • name_begins – characters that the user name must begin with.

  • abbreviation_begins – characters that the abbreviation must begin with.

  • to_dictionary – If True returns dict, by default (False) returns User objects.

  • limit – limit the number of elements returned. If None (default), all objects are returned.

  • **filters – Available filter parameters: [‘id’, ‘name’, ‘abbreviation’, ‘description’, ‘type’, ‘subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’, ‘icon_path’, ‘owner’, ‘initials’, ‘enabled’]

Examples

>>> list_users(connection, name_begins='user', initials='UR')

mstrio.users_and_groups.user_connections module

class mstrio.users_and_groups.user_connections.UserConnections(connection: Connection)

Bases: object

Browse and manage active user connections on the environment. Use the fetch() method to fetch the latest active user connections. Filter the user_connections by using filter_connections() method.

connection

A MicroStrategy connection object

user_connections

All active user connections on the environment

disconnect_all_users(force: bool = False) list[dict] | None

Disconnect all user connections.

Parameters:

force – if True, no additional prompt will be shown before disconnecting all users

Returns:

  • list of statuses of disconnecting all connections with their ids

    and messages from the I-Server

  • in case of error it returns None

disconnect_users(connection_ids: str | list[str] | None = None, users: list['User'] | list[str] | None = None, nodes: str | list[str] | None = None, force: bool = False, **filters) list[dict] | None

Disconnect user connections by passing in users (objects) or connection_ids. Optionally disconnect users by specifying the filters keyword arguments.

Parameters:
  • connection_ids – chosen ids that can be retrieved with list_connections()

  • users – List of User objects or usernames

  • nodes – Node (server) names on which users will be disconnected

  • force – if True, no additional prompt will be shown before disconnecting users

  • **filters – Available filter parameters: [‘id’, ‘parent_id’, ‘username’, ‘user_full_name’, ‘project_index’, ‘project_id’, ‘project_name’, ‘open_jobs_count’, ‘project_type’, ‘date_connection_created’, ‘duration’, ‘session_id’, ‘client’, ‘config_level’]

Returns:

  • list of statuses of disconnecting chosen connections with theirs ids and messages from the I-Server:

    status code 200 is when all connections were disconnected status code 207 is when some connections were disconnected status code 403 without error code is when no connections were disconnected

  • in case of error of nothing to disconnect it returns None

fetch() None

Populate the UserConnections object by retrieving all active user connections on the environment.

filter_connections(**filters) list[dict[str, Any]] | None

Filter the user connections stored in the UserConnections object by specifying the filters keyword arguments.

Parameters:

**filters – Available filter parameters: [‘id’, ‘parent_id’, ‘username’, ‘user_full_name’, ‘project_index’, ‘project_id’, ‘project_name’, ‘open_jobs_count’, ‘project_type’, ‘date_connection_created’, ‘duration’, ‘session_id’, ‘client’, ‘config_level’]

list_connections(nodes: str | list[str] | None = None, limit: int | None = None, **filters) list[dict[str, Any]]

Get all active user connections. Optionally filter the connections by specifying the filters keyword arguments.

Parameters:
  • nodes – Node (server) names on which users will be disconnected.

  • limit – limit the number of elements returned. If None, all objects are returned.

  • **filters – Available filter parameters: [‘id’, ‘parent_id’, ‘username’, ‘user_full_name’, ‘project_index’, ‘project_id’, ‘project_name’, ‘open_jobs_count’, ‘project_type’, ‘date_connection_created’, ‘duration’, ‘session_id’, ‘client’, ‘config_level’, ‘application_type’, ‘last_action’]

mstrio.users_and_groups.user_group module

class mstrio.users_and_groups.user_group.UserGroup(connection: Connection, name: str | None = None, id: str | None = None)

Bases: Entity, DeleteMixin, TrusteeACLMixin, TranslationMixin

Object representation of MicroStrategy User Group object.

connection

A MicroStrategy connection object

memberships

User Groups that the User Group is a member of

members

users that are members of User Group

security_roles

security roles that the User Group is a member of

privileges

user privileges per project

id

User ID

name

User name

type

Object type

subtype

Object subtype

ext_type

Object extended type

abbreviation

Object abbreviation

description

Object description

date_created

Creation time, DateTime object

date_modified

Last modification time, DateTime object

version

Object version ID

owner

Owner name and ID

ancestors

List of ancestor folders

settings

Settings of User Group

acg

Access rights (See EnumDSSXMLAccessRightFlags for possible values)

acl

Object access control list

add_to_user_groups(groups: str | mstrio.users_and_groups.user_group.UserGroup | list[str | mstrio.users_and_groups.user_group.UserGroup]) None

Add User Group to passed groups.

Parameters:

groups – List of User Group objects or ids

add_users(users: str | User | list[str | User]) None

Add members to the User Group.

Parameters:

users – List of User objects or ids

alter(name: str | None = None, description: str | None = None, ldapdn: str = None, comments: str | None = None)

Alter User Group name or/and description.

Parameters:
  • name – New name of the User Group

  • description – New description of the User Group

  • comments – Long description of the User Group

apply_security_filter(security_filter: SecurityFilter | str)

Apply a security filter to the user group.

Parameters:

security_filter (string or object) – identifier of security filter or SecurityFilter object which will be applied to the user group.

Returns:

True when applying was successful. False otherwise.

assign_security_role(security_role: SecurityRole | str, project: Project | str) None

Assigns a Security Role to the User Group for given project.

Parameters:
  • security_role – Security Role ID or object

  • project – Project name or object

classmethod create(connection: Connection, name: str, description: str | None = None, memberships: list[str] | None = None, members: list[str] | None = None, ldapdn: str | None = None)

Create a new User Group on the I-Server. Returns UserGroup object.

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection()

  • name – Name of a newly created User Group

  • description – Description of a newly created User Group

  • memberships – Specify User Groups which newly created User Group will be member

  • members – Specify Users which will be members of newly created User Group

  • ldapdn – User group’s LDAP distinguished name

get_settings() dict

Get the User Group settings from the I-Server.

grant_privilege(privilege: str | list[str] | Privilege | list[Privilege]) None

Grant privileges directly to the User Group.

Parameters:

privilege – List of privilege objects, ids or names

list_members(**filters) list['User | UserGroup']

List user group members.

Optionally filter the results by passing filter keyword arguments.

Parameters:

**filters – Available filter parameters: ‘name’, ‘id’, ‘type’, ‘abbreviation’, subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’, ‘owner’, source’, ext_type’, ‘username’, full_name’, enabled’

list_privileges(mode: mstrio.access_and_security.privilege_mode.PrivilegeMode | str = PrivilegeMode.ALL, to_dataframe: bool = False) list

List privileges for user group.

Parameters:
  • mode – Specifies which privileges to list. See: privilege.PrivilegeMode enum.

  • to_dataframe – If True, return a DataFrame object containing privileges

list_security_filters(projects: str | list[str] | None = None, to_dictionary: bool = False) dict

Get the list of security filters for user group. They can be filtered by the projects’ ids.

Parameters:
  • projects (str or list of str, optional) – collection of projects’ ids which is used for filtering data

  • to_dictionary – If True returns security filters as dicts, by default (False) returns them as objects.

Returns:

Dictionary with project names as keys and list with security filters as values. In case of no security filter for the given user group in the particular project, then this project is not placed in the dictionary.

remove_all_users() None

Remove all members from user group.

remove_from_user_groups(groups: str | mstrio.users_and_groups.user_group.UserGroup | list[str | mstrio.users_and_groups.user_group.UserGroup]) None

Remove User Group from passed groups

Parameters:

groups – List of User Group objects or ids

remove_users(users: str | User | list[str | User]) None

Remove members from User Group.

Parameters:

users – List of User objects or ids

revoke_all_privileges(force: bool = False) None

Revoke directly granted group privileges.

Parameters:

force – If True, no additional prompt will be shown before revoking all privileges from User Group

revoke_privilege(privilege: str | list[str] | Privilege | list[Privilege]) None

Revoke directly granted User Group privileges.

Parameters:

privilege – List of privilege objects, ids or names

revoke_security_filter(security_filter: SecurityFilter | str)

Revoke a security filter from the user group.

Parameters:

security_filter (string or object) – identifier of security filter or SecurityFilter object which will be revoked from the user group.

Returns:

True when revoking was successful. False otherwise.

revoke_security_role(security_role: mstrio.access_and_security.security_role.SecurityRole | str, project: Project | str) None

Removes a Security Role from the User Group for given project.

Parameters:
  • security_role – Security Role ID or object

  • project – Project name or object

mstrio.users_and_groups.user_group.list_user_groups(connection: Connection, name_begins: str | None = None, to_dictionary: bool = False, limit: int | None = None, **filters) list[mstrio.users_and_groups.user_group.UserGroup]

Get list of User Group objects or User Group dicts. Optionally filter the User Groups by specifying ‘name_begins’ or other filters.

Optionally use to_dictionary or to_dataframe to choose output format. If to_dictionary is True, to_dataframe is omitted.

Wildcards available for name_begins:

? - any character * - 0 or more of any characters e.g. name_begins = ?onny will return Sonny and Tonny

Parameters:
  • connection – MicroStrategy connection object returned by connection.Connection()

  • name_begins – Beginning of a User Groups name which we want to list

  • to_dictionary – If True returns dict, by default (False) returns User Group objects

  • limit – limit the number of elements returned. If None (default), all objects are returned.

  • **filters – Available filter parameters: [‘name’, ‘id’, ‘type’, ‘abbreviation’, ‘description’, ‘subtype’, ‘date_created’, ‘date_modified’, ‘version’, ‘acg’, ‘owner’, ‘ext_type’]

Examples

>>> list_user_groups(connection, name_begins='Group',
>>>                  description='New group')

Module contents