pycti.entities.opencti_role =========================== .. py:module:: pycti.entities.opencti_role Classes ------- .. autoapisummary:: pycti.entities.opencti_role.Role Module Contents --------------- .. py:class:: Role(opencti) Representation of a role in OpenCTI Roles can have capabilities. Groups have roles, and the combined capabilities of those roles determine what a group of users can do on the platform. Check the properties attribute of the class to understand what default properties are fetched. :param opencti: instance of :py:class:`~pycti.api.opencti_api_client.OpenCTIApiClient` :type opencti: OpenCTIApiClient Initialize the Role instance. :param opencti: OpenCTI API client instance :type opencti: OpenCTIApiClient .. py:attribute:: opencti .. py:attribute:: properties :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ id standard_id entity_type parent_types name description created_at updated_at capabilities { id name description } capabilitiesInDraft { id name description } can_manage_sensitive_config """ .. raw:: html
.. py:method:: list(**kwargs) -> List[Dict] Search or list the roles on the server. :param search: Defaults to None. :type search: str, optional :param first: Defaults to 500 Return the first x results from ID or beginning if $after is not specified. :type first: int, optional :param after: Return all results after the given ID, useful for pagination. Ignored if returning all results, defaults to None. :type after: str, optional :param orderBy: Field to order by. Must be one of "name", "created_at", "updated_at", or "_score". Defaults to "name", defaults to "name". :type orderBy: str, optional :param orderMode: Direction to order in, either "asc" or "desc", defaults to "asc". :type orderMode: str, optional :param customAttributes: Defaults to None. Custom attributes to return from query. If None, defaults are used. :type customAttributes: str, optional :param getAll: Defaults to False. Retrieve all results. If true then the "first" param is ignored. :type getAll: bool, optional :param withPagination: Defaults to False Whether to include pagination pageInfo properties in result. :type withPagination: bool, optional :return: List of Python dictionaries with the properties of the role. :rtype: List[Dict] .. py:method:: read(**kwargs) -> Optional[Dict] Get a role given its ID or a search term One of id or search must be provided. :param id: ID of the role on the platform :type id: str, optional :param search: Search term for a role, e.g. its name :type search: str, optional :param customAttributes: Custom attributes on the role to return :type customAttributes: str, optional :return: Representation of the role :rtype: Optional[Dict] .. py:method:: delete(**kwargs) Delete a role given its ID :param id: ID for the role on the platform. :type id: str .. py:method:: create(**kwargs) -> Optional[Dict] Add a new role to OpenCTI. :param name: Name to assign to the role. :type name: str :param description: Optional. Description of the role, defaults to None. :type description: str, optional :param customAttributes: Custom attributes to return on role :type customAttributes: str, optional :return: Representation of the role. :rtype: Optional[Dict] .. py:method:: update_field(**kwargs) -> Optional[Dict] Updates a given role with the given inputs Example of input:: [ { "key": "name", "value": "NewCustomRole" }, { "key": "can_manage_sensitive_config", "value": False } ] :param id: ID for the role on the platform :type id: str :param input: List of EditInput objects :type input: List[Dict] :param customAttributes: Custom attributes to return on the role :type customAttributes: str, optional :return: Representation of the role :rtype: Optional[Dict] .. py:method:: add_capability(**kwargs) -> Optional[Dict] Adds a capability to a role :param id: ID of the role. :type id: str :param capability_id: ID of the capability to add. :type capability_id: str :return: Representation of the relationship, including the role and capability :rtype: Optional[Dict] .. py:method:: delete_capability(**kwargs) -> Optional[Dict] Removes a capability from a role :param id: ID of the role :type id: str :param capability_id: ID of the capability to remove :type capability_id: str :return: Representation of the role after removing the capability :rtype: Optional[Dict] .. py:method:: process_multiple_fields(data) Process and normalize fields in role data. :param data: the role data dictionary to process :type data: dict :return: the processed role data with normalized fields :rtype: dict