claims-0.1.6
توضیحات
Port of https://github.com/eturino/claims.ts. Library to manage claims and permissions.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | claims-0.1.6 |
| نام | claims |
| نسخه کتابخانه | 0.1.6 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Eduardo Turiño |
| ایمیل نویسنده | eturino@eturino.com |
| آدرس صفحه اصلی | https://github.com/eturino/claims.py |
| آدرس اینترنتی | https://pypi.org/project/claims/ |
| مجوز | Apache 2.0 |
# Claims
Port of [`claims.ts`](https://github.com/eturino/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
- `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`
TBD
نیازمندی
| مقدار | نام |
|---|---|
| - | attrs |
| - | key-set |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >= 3.6 | Python |
نحوه نصب
نصب پکیج whl claims-0.1.6:
pip install claims-0.1.6.whl
نصب پکیج tar.gz claims-0.1.6:
pip install claims-0.1.6.tar.gz