mstrio.modeling.security_filter package

Submodules

mstrio.modeling.security_filter.security_filter module

class mstrio.modeling.security_filter.security_filter.SecurityFilter(connection: Connection, id: str | None = None, name: str | None = None, show_expression_as: mstrio.modeling.expression.enums.ExpressionFormat | str = ExpressionFormat.TREE, show_filter_tokens: bool = False)

Bases: Entity, CopyMixin, DeleteMixin, MoveMixin, TranslationMixin

Python representation of MicroStrategy Security Filter object.

name

name of the security filter

id

security filter ID

description

description of the security filter

sub_type

string literal used to identify the type of a metadata object, ObjectSubType enum

version

object version ID

ancestors

list of ancestor folders

type

object type, ObjectTypes enum

ext_type

object extended type, ExtendedType enum

date_created

creation time, DateTime object

date_modified

last modification time, DateTime object

owner

User object that is the owner

acg

access rights (See EnumDSSXMLAccessRightFlags for possible values)

acl

object access control list

is_embedded

if true indicates that the target object of this reference is embedded within this object, if this field is omitted (as is usual) then the target is not embedded

path

the path of the object, read only

primary_locale

the primary locale of the object, in the IETF BCP 47 language tag format, such as “en-US”, read only

qualification

the security filter definition written as an expression tree over predicate nodes, Security Filter support all kinds of predicates but bandings

destination_folder_id

a globally unique identifier used to distinguish between metadata objects within the same project

top_level

the top level attribute list

Type:

list of SchemaObjectReference or list of dicts, optional

bottom_level

the bottom level attribute list

Type:

list of SchemaObjectReference or list of dicts, optional

hidden

Specifies whether the object is hidden

alter(name: str | None = None, description: str | None = None, destination_folder_id: str | None = None, qualification: mstrio.modeling.expression.expression.Expression | dict | None = None, is_embedded: bool | None = None, top_level: list[dict] | list[mstrio.modeling.schema.helpers.SchemaObjectReference] | None = None, bottom_level: list[dict] | list[mstrio.modeling.schema.helpers.SchemaObjectReference] | None = None, hidden: bool | None = None, comments: str | None = None)

Alter the security filter properties.

Parameters:
  • name (str, optional) – name of a security filter

  • description (str, optional) – description of a security filter

  • destination_folder_id (str, optional) – a globally unique identifier used to distinguish between objects within the same project

  • qualification (Expression, dict, optional) – the security filter

  • nodes (definition written as an expression tree over predicate) –

  • is_embedded (bool, optional) – if true indicates that the target object of this reference is embedded within this object

  • top_level (list of SchemaObjectReference or list of dicts, optional) – the top level attribute list

  • dicts (bottom_level(list of SchemaObjectReference or list of) – optional): the bottom level attribute list

:param : optional): the bottom level attribute list :param hidden: Specifies whether the object is hidden.

Default value: False.

Parameters:

comments (str, optional) – Long description of the security filter.s

apply(users_and_groups: list[mstrio.users_and_groups.user.User] | list[mstrio.users_and_groups.user_group.UserGroup] | list[str] | mstrio.users_and_groups.user.User | mstrio.users_and_groups.user_group.UserGroup | str | None = None)

Updates members information for a specific security filter. Grants a security filter to users or user groups.

Parameters:
  • users_and_groups (string, object, list of strings or objects) – list

  • groups (or a single element specifying to which users and user) –

  • whole (security filter will be applied. It is possible to provide the) –

  • object (providing a list it can contain User) –

  • object

  • id (s) –

Returns:

True when applying was successful. False otherwise.

classmethod create(connection: Connection, name: str, destination_folder: mstrio.object_management.folder.Folder | str, qualification: mstrio.modeling.expression.expression.Expression | dict, description: str | None = None, is_embedded: bool = False, primary_locale: str | None = None, show_expression_as: mstrio.modeling.expression.enums.ExpressionFormat | str = ExpressionFormat.TREE, show_filter_tokens: bool = False, top_level: list[dict] | list[mstrio.modeling.schema.helpers.SchemaObjectReference] | None = None, bottom_level: list[dict] | list[mstrio.modeling.schema.helpers.SchemaObjectReference] | None = None) SecurityFilter

Create a new security filter in a specific project.

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

  • name (str) – name of a new security filter

  • destination_folder (str or object) – a globally unique identifier or unique folder name used to distinguish between metadata objects within the same project

  • qualification (Expression or dict) – new security filter definition written as an expression tree over predicate nodes. It can be provided as Qualification object or dictionary.

  • description (str, optional) – optional description of a new security filter

  • is_embedded (bool, optional) – if true indicates that the target object of this reference is embedded within this object

  • primary_locale (str, optional) – the primary locale of the object, in the IETF BCP 47 language tag format, such as “en-US”

  • show_expression_as (ExpressionFormat or str, optional) – specify how expressions should be presented Available values: - None (expression is returned in “text” format) - ExpressionFormat.TREE or tree (expression is returned in text and tree formats) - ExpressionFormat.TOKENS or tokens (expression is returned in text and tokens formats)

  • show_filter_tokens (bool, optional) – specify whether “qualification” is returned in “tokens” format, along with text and tree formats. - If omitted or false, only text and tree formats are returned. - If true, all text, “tree” and tokens formats are returned.

  • top_level (list of SchemaObjectReference or list of dicts, optional) – the top level attribute list

  • dicts (bottom_level(list of SchemaObjectReference or list of) – optional): the bottom level attribute list

:param : optional): the bottom level attribute list

Returns:

Security Filter object

revoke(users_and_groups: list[mstrio.users_and_groups.user.User] | list[mstrio.users_and_groups.user_group.UserGroup] | list[str] | mstrio.users_and_groups.user.User | mstrio.users_and_groups.user_group.UserGroup | str | None = None)

Updates members information for a specific security filter. Revokes a security filter from users or groups.

Parameters:
  • users_and_groups (string, object, list of strings or objects) – list

  • groups (or a single element specifying to which users and user) –

  • whole (security filter will be applied. It is possible to provide the) –

  • object (providing a list it can contain User) –

  • object

  • id (s) –

Returns:

True when applying was successful. False otherwise.

class mstrio.modeling.security_filter.security_filter.UpdateOperator(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Bases: Enum

APPLY = 'addElements'
REVOKE = 'removeElements'
mstrio.modeling.security_filter.security_filter.list_security_filters(connection: Connection, name_contains: str | None = None, to_dictionary: bool = False, offset: int | None = None, limit: int | None = None, project_id: str | None = None, project_name: str | None = None, show_expression_as: mstrio.modeling.expression.enums.ExpressionFormat | str = ExpressionFormat.TREE, show_filter_tokens: bool = False, user: mstrio.users_and_groups.user.User | str | None = None, user_group: mstrio.users_and_groups.user_group.UserGroup | str | None = None, **filters) list[type['SecurityFilter']] | list[dict]

Get a list of Security Filter objects or dicts. Optionally filter the objects by specifying filters parameter. It can also be filtered by user or user group.

Note: It is not possible to provide both user and user_group parameter.

When both arguments are provided error is raised.

Specify either project_id or project_name. When project_id is provided (not None), project_name is omitted.

Note

When project_id is None and project_name is None, then its value is overwritten by project_id from connection object.

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

  • name_contains (str, optional) – Text that security filter’s name must contain

  • to_dictionary (bool, optional) – If True returns dictionaries, by default (False) returns SecurityFilter objects.

  • offset (int, optional) – Starting point within the collection of returned results. Used to control paging behavior.

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

  • project_id (str, optional) – Project ID

  • project_name (str, optional) – Project name

  • show_expression_as (ExpressionFormat or str, optional) – Specify how expressions should be presented Available values: - None (expression is returned in “text” format) - ExpressionFormat.TREE or tree (expression is returned in text and tree formats) - ExpressionFormat.TOKENS or tokens (expression is returned in text and tokens formats)

  • show_filter_tokens (bool, optional) – Specify whether “qualification” is returned in “tokens” format, along with text and tree formats. - If omitted or false, only text and tree formats are returned. - If true, all text, tree and tokens formats are returned.

  • user (str or object, optional) – Id of user or User object used to filter security filters

  • user_group (str or object, optional) – Id of user group or UserGroup object used to filter security filters

  • **filters – Available filter parameters: [‘id’, ‘name’, ‘description’, ‘date_created’, ‘date_modified’, ‘total_users’, ‘total_user_groups’]

Returns:

list of security filter objects or list of security filter dictionaries.

Module contents