Skip to main content

Claims

Port of claims.ts

Usage

Ability:

  • ability = build_ability(permitted=["read:*", "admin:something"], prohibited=["admin:bad"])
  • ability.can("read:stuff"): bool
  • ability.cannot("admin:others"): bool
  • ability.is_explicitly_prohibited("admin:bad.inside"): bool
  • ability.access_to_resources("read:clients") returns a KeySet

ClaimSet

  • claim_set = build_claim_set(["read:*", "admin:something"])
  • claim_set.check("read:stuff"): bool
  • claim_set.direct_children_of("read:stuff"): List[str]
  • claim_set.direct_descendants_of("read:stuff"): List[str]
  • claim_set.add_if_not_checked("read:stuff"): ClaimSet (same instance if claim_set.check("read:stuff") is True, a new one with the claim added otherwise).

Claim

  • claim = build_claim("read:*")
  • claim.is_global(): bool
  • claim.has_verb("read"): bool
  • claim.has_resource("*"): bool
  • claim.is_exact("read:*"): bool
  • claim.check("read:stuff"): bool
  • claim.direct_child_of("read:stuff"): Optional[str]
  • claim.direct_descendant_of("read:stuff"): Optional[str]
  • claim.is_direct_child_of("read:stuff"): bool
  • claim.is_direct_descendant_of("read:stuff"): bool

Valid verbs

"admin", "read", "delete", "create", "update", "manage"

Metadata

Release files for claims 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for claims 0.3.0
File Interpreter ABI Platform
claims-0.3.0-py3-none-any.whl Python 3 none any Details

Release files / claims-0.3.0-py3-none-any.whl

Download URL claims-0.3.0-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
eea461e7a8578903bc8e3550f530e1b3598bdbe2e28b9ee97eb5bc638e627ab4
BLAKE2b-256 checksum
How to use checksums
8fee8833254b16318d288bb1dc91b36668bd5f66564df9a0c0d4b5e4152955c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.11

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.11

1 release file

0.1.10

1 release file

0.1.8

1 release file

0.1.7

1 release file

0.1.6

1 release file

0.1.5

1 release file

0.1.4

1 release file

0.1.2

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page