Skip to content

cmem_client.repositories.access_conditions¤

Repository for the access conditions of Corporate Memory.

Provides AccessConditionsRepository for creating, updating and deleting access conditions, and for inspecting the accounts, groups and actions they can refer to.

Examples:

Inspect what access conditions can be granted to whom:

>>> from cmem_client.client import Client
>>> client = Client.from_env()
>>> client.access_conditions.get_users()
>>> client.access_conditions.get_groups()
>>> for action in client.access_conditions.get_actions():
...     print(action.iri)

List the configured access conditions:

>>> for iri in client.access_conditions:
...     print(iri, client.access_conditions[iri])

Reload the access conditions after a change:

>>> client.access_conditions.refresh()

Classes:

AccessConditionsCreateConfig¤

Bases: CreateConfig

Access condition creation config.

Attributes:

  • model_config

AccessConditionsDeleteConfig¤

Bases: DeleteConfig

Access conditions delete config.

Attributes:

  • model_config

AccessConditionsRepository¤

Bases: PagedListRepository, DeleteItemProtocol, CreateItemProtocol, UpdateItemProtocol

Repository for managing authorization access conditions.

This repository manages access conditions that control authorization for resources in Corporate Memory. Access conditions are described with the AccessCondition model.

The repository extends PagedListRepository and implements protocols for creating and deleting access conditions.

Functions:

  • create_item – Create (add) a new item to the repository
  • delete_all – Delete all items from the repository
  • delete_item – Delete an item from the repository
  • fetch_data – Fetch a paged list from a JSON endpoint via a type adapter.
  • get_actions – Return the list of actions that can be granted by access conditions.
  • get_groups – Return the list of group IRIs known to the authorization system.
  • get_users – Return the list of user IRIs known to the authorization system.
  • items – Get the items of the repository
  • keys – Get the keys of the repository
  • raise_modification_error – Raise an exception if needed
  • refresh – Refresh the DataPlatform access-condition cache.
  • review – Review access rights for a given account and groups.
  • update_item – Update an existing item in the repository.
  • values – Get the values of the repository

Attributes:

  • logger (Logger) – Gets the client logger

create_item¤

create_item(item, skip_if_existing=False, configuration=None)

Create (add) a new item to the repository

Parameters:

  • item (ItemType) – The item to add to the repository
  • skip_if_existing (bool) – If true, creating already existing items will be ignored
  • configuration (CreateItemConfig_contra | None) – Optional configuration

Raises:

delete_all¤

delete_all()

Delete all items from the repository

delete_item¤

delete_item(key, skip_if_missing=False, configuration=None)

Delete an item from the repository

Parameters:

  • key (str) – The key of the item to delete
  • skip_if_missing (bool) – If True, it is ignored if the deleted item even exists
  • configuration (DeleteItemConfig) – Optional configuration for deletion

Raises:

fetch_data¤

fetch_data()

Fetch a paged list from a JSON endpoint via a type adapter.

Use this method to fetch data if your result set is a pageable spring endpoint.

get_actions¤

get_actions()

Return the list of actions that can be granted by access conditions.

get_groups¤

get_groups()

Return the list of group IRIs known to the authorization system.

get_users¤

get_users()

Return the list of user IRIs known to the authorization system.

items¤

items()

Get the items of the repository

keys¤

keys()

Get the keys of the repository

logger¤

logger: logging.Logger

Gets the client logger

raise_modification_error¤

raise_modification_error(response)

Raise an exception if needed

refresh¤

refresh()

Refresh the DataPlatform access-condition cache.

Instructs the DataPlatform to reload its in-memory authorization rules from the ACL graphs. Must be called after bulk SPARQL changes to ACL graphs so the DataPlatform picks up the new rules without a restart.

Raises:

  • HTTPStatusError – If the refresh request fails.

review¤

review(account_iri=None, group_iris=None)

Review access rights for a given account and groups.

Parameters:

  • account_iri (str | None) – The IRI of the account to review.
  • group_iris (list[str] | None) – Optional list of group IRIs to include in the review.

Returns:

update_item¤

update_item(item, configuration=None)

Update an existing item in the repository.

Parameters:

  • item (ItemType) – The item to update in the repository.
  • configuration (UpdateItemConfig_contra | None) – Optional configuration for the update operation.

Raises:

values¤

values()

Get the values of the repository

AccessConditionsUpdateConfig¤

Bases: UpdateConfig

Access condition update config.

Attributes:

  • model_config

Comments