Port of https://github.com/eturino/claims.ts. Library to manage claims and permissions.
Project description
Claims
Port of claims.ts
Usage
Ability:
ability = build_ability(permitted=["read:*", "admin:something"], prohibited=["admin:bad"])ability.can("read:stuff"):boolability.cannot("admin:others"):boolability.is_explicitly_prohibited("admin:bad.inside"):boolability.access_to_resources("read:clients")returns aKeySet
ClaimSet
claim_set = build_claim_set(["read:*", "admin:something"])claim_set.check("read:stuff"):boolclaim_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 ifclaim_set.check("read:stuff")is True, a new one with the claim added otherwise).
Claim
claim = build_claim("read:*")claim.is_global():boolclaim.has_verb("read"):boolclaim.has_resource("*"):boolclaim.is_exact("read:*"):boolclaim.check("read:stuff"):boolclaim.direct_child_of("read:stuff"):Optional[str]claim.direct_descendant_of("read:stuff"):Optional[str]claim.is_direct_child_of("read:stuff"):boolclaim.is_direct_descendant_of("read:stuff"):bool
Valid verbs
"admin", "read", "delete", "create", "update", "manage"
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
claims-0.3.0-py3-none-any.whl
(12.8 kB
view details)
File details
Details for the file claims-0.3.0-py3-none-any.whl.
File metadata
- Download URL: claims-0.3.0-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eea461e7a8578903bc8e3550f530e1b3598bdbe2e28b9ee97eb5bc638e627ab4
|
|
| MD5 |
f5299a0fbd4470d2d17ed458ef9c6657
|
|
| BLAKE2b-256 |
8fee8833254b16318d288bb1dc91b36668bd5f66564df9a0c0d4b5e4152955c4
|