mstrio > users_and_groups > user_connections¶
- class mstrio.users_and_groups.user_connections.UserConnections(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.
- Parameters:
connection (Connection) –
- connection¶
A Strategy One connection object
- user_connections¶
All active user connections on the environment
- disconnect_all_users(force=False)¶
Disconnect all user connections.
- Parameters:
force (bool) – 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
- Return type:
list[dict] | None
- disconnect_users(connection_ids=None, users=None, nodes=None, force=False, **filters)¶
Disconnect user connections by passing in users (objects) or connection_ids. Optionally disconnect users by specifying the filters keyword arguments.
- Parameters:
connection_ids (str | list[str] | None) – chosen ids that can be retrieved with list_connections()
users (list['User'] | list[str] | None) – List of User objects or usernames
nodes (str | list[str] | None) – Node (server) names on which users will be disconnected
force (bool) – 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
- Return type:
list[dict] | None
- fetch()¶
Populate the UserConnections object by retrieving all active user connections on the environment.
- Return type:
None
- filter_connections(**filters)¶
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’]
- Return type:
list[dict[str, Any]] | None
- list_connections(nodes=None, limit=None, **filters)¶
Get all active user connections. Optionally filter the connections by specifying the filters keyword arguments.
- Parameters:
nodes (str | list[str] | None) – Node (server) names on which users will be disconnected.
limit (int | None) – 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’]
- Return type:
list[dict[str, Any]]