betty.privacy package - Betty documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.privacy package

## Submodules

- betty.privacy.privatizer module
  - `Privatizer`
    - `Privatizer.__init__()`
    - `Privatizer.has_expired()`
    - `Privatizer.privatize()`

## Module contents

The Privacy API.

class betty.privacy.HasPrivacy

  Bases: `LinkedDataDumpableJsonLdObject`

  A resource that has privacy.

  __init__(*args: Any, privacy: Privacy | None = None, public: bool | None = None, private: bool | None = None, **kwargs: Any)
  async dump_linked_data(project: Project) → DumpMapping[Dump]

    Dump this instance to JSON-LD.

  async classmethod linked_data_schema(project: Project) → JsonLdObject

    Define the JSON Schema for `betty.json.linked_data.LinkedDataDumpable.dump_linked_data()`.

  property own_privacy: Privacy

    The resource’s own privacy.

    This returns the value that was set for `betty.privacy.HasPrivacy.privacy` and ignores computed privacies.

    For access control and permissions checking, use `betty.privacy.HasPrivacy.privacy`.

  property privacy: Privacy

    The resource’s privacy.

  property private: bool

    Whether this resource is private.

  property public: bool

    Whether this resource is public.

class betty.privacy.Privacy

  Bases: `Enum`

  The available privacy modes.

  PRIVATE = 2

    The resource is explicitly made private.

  PUBLIC = 1

    The resource is explicitly made public.

  UNDETERMINED = 3

    The resource has no explicit privacy. This means that:

    - it may be changed at will

    - when checking access, UNDETERMINED evaluates to PUBLIC.

class betty.privacy.PrivacySchema

  Bases: `Boolean`

  A JSON Schema for privacy.

  __init__()

betty.privacy.is_private(target: Any) → bool

  Check if the given target is private.

betty.privacy.is_public(target: Any) → bool

  Check if the given target is public.

betty.privacy.merge_privacies(*privacies: Privacy | HasPrivacy | None) → Privacy

  Merge multiple privacies into one.

betty.privacy.resolve_privacy(privacy: Privacy | HasPrivacy | None) → Privacy

  Resolve the privacy of a value.