antimatter.session_mixins.capability_mixin#

Module Contents#

Classes#

CapabilityMixin

Session mixin defining CRUD functionality for capabilities.

class antimatter.session_mixins.capability_mixin.CapabilityMixin(authz: antimatter.authz.Authorization, **kwargs)#

Bases: antimatter.session_mixins.base.BaseMixin

Session mixin defining CRUD functionality for capabilities.

list_capabilities() List[antimatter_api.CapabilityDefinition]#

Get the capabilities for the session’s domain.

Returns:

A list of capabilities.

get_capability(name: str) antimatter_api.CapabilityDefinition#

Get a specific capability for the session’s domain.

Parameters:

name – The name for this capability, like “admin”

Returns:

The details of the capability.

put_capability(name: str, summary: str, description: str | None = None, unary: bool = True, create_only: bool = False) None#

Create or update a capability. A capability is attached to authenticated domain identities by an identity provider, and confers additional permissions upon the identity. This is done by writing domain policy rules that reference the capability.

Parameters:
  • name – The name for this capability, like “admin”

  • summary – A short, single sentence description of this capability

  • description – An optional longer form description of this capability

  • unary – A unary capability does not have a value

  • create_only – If True, an error will be returned if a capability with the name already exists

delete_capability(name: str) None#

Delete a capability.

Parameters:

name – The name of the capability, like “admin”