claims


Nameclaims JSON
Version 0.2.2 PyPI version JSON
download
home_pagehttps://github.com/eturino/claims.py
SummaryPort of https://github.com/eturino/claims.ts. Library to manage claims and permissions.
upload_time2023-10-10 11:15:12
maintainer
docs_urlNone
authorEduardo Turiño
requires_python>= 3.6
licenseApache 2.0
keywords claims permissions
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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_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"

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/eturino/claims.py",
    "name": "claims",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">= 3.6",
    "maintainer_email": "",
    "keywords": "claims permissions",
    "author": "Eduardo Turi\u00f1o",
    "author_email": "eturino@eturino.com",
    "download_url": "",
    "platform": null,
    "description": "# Claims\n\nPort of [`claims.ts`](https://github.com/eturino/claims.ts)\n\n## Usage\n\n### Ability:\n\n-   `ability = build_ability(permitted=[\"read:*\", \"admin:something\"], prohibited=[\"admin:bad\"])`\n-   `ability.can(\"read:stuff\")`: `bool`\n-   `ability.cannot(\"admin:others\")`: `bool`\n-   `ability.is_explicitly_prohibited(\"admin:bad.inside\")`: `bool`\n-   `ability.access_to_resources(\"read:clients\")` returns a `KeySet`\n\n### ClaimSet\n\n-   `claim_set = build_claim_set([\"read:*\", \"admin:something\"])`\n-   `claim_set.check(\"read:stuff\")`: `bool`\n-   `claim_set.direct_children_of(\"read:stuff\")`: `List[str]`\n-   `claim_set.direct_descendants_of(\"read:stuff\")`: `List[str]`\n-   `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).\n\n### Claim\n\n-   `claim = build_claim(\"read:*\")`\n-   `claim.is_global()`: `bool`\n-   `claim.has_verb(\"read\")`: `bool`\n-   `claim.has_resource(\"*\")`: `bool`\n-   `claim.is_exact(\"read:*\")`: `bool`\n-   `claim.check(\"read:stuff\")`: `bool`\n-   `claim.direct_child_of(\"read:stuff\")`: `Optional[str]`\n-   `claim.direct_descendant_of(\"read:stuff\")`: `Optional[str]`\n-   `claim.is_direct_child_of(\"read:stuff\")`: `bool`\n-   `claim.is_direct_descendant_of(\"read:stuff\")`: `bool`\n\n### Valid verbs\n\n\"admin\", \"read\", \"delete\", \"create\", \"update\", \"manage\"\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "Port of https://github.com/eturino/claims.ts. Library to manage claims and permissions.",
    "version": "0.2.2",
    "project_urls": {
        "Homepage": "https://github.com/eturino/claims.py"
    },
    "split_keywords": [
        "claims",
        "permissions"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "35ebeac28b71a580cbcfe3dbc2eb50c6a6d45163c3b9e3523a812cd56cb8bfe7",
                "md5": "86702e0d135cd2bfeab4a431b2d577f8",
                "sha256": "140785b7190b724ffee5999081b75c7b4d32980bc0094bbf6c302a5212214808"
            },
            "downloads": -1,
            "filename": "claims-0.2.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "86702e0d135cd2bfeab4a431b2d577f8",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">= 3.6",
            "size": 12542,
            "upload_time": "2023-10-10T11:15:12",
            "upload_time_iso_8601": "2023-10-10T11:15:12.556978Z",
            "url": "https://files.pythonhosted.org/packages/35/eb/eac28b71a580cbcfe3dbc2eb50c6a6d45163c3b9e3523a812cd56cb8bfe7/claims-0.2.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-10 11:15:12",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "eturino",
    "github_project": "claims.py",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "claims"
}
        
Elapsed time: 0.13598s