Skip to main content

Whocan

Library for defining and determining access.

Usage

YAML usage

statements:
- effect: allow
  actions:
  - workspace:Create*
  - workspace:Delete*
  - workspace:Get*
  - workspace:List*
  - workspace:Update*
  resources:
  - workspace:individual-${username}
import pathlib
import whocan

policy = whocan.Policy.load(pathlib.Path('path-to-file.yaml'))
policy.is_allowed(
    resource='workspaces:individual-my-username',
    action='workspace:DeletePage',
    arguments={'username': 'my-username'},
)
# True
policy.is_allowed(
    resource='workspaces:individual-a-different-user',
    action='workspace:DeletePage',
    arguments={'username': 'my-username'},
)
# False

Pure python usage

import whocan

statement = whocan.Statement(
    resources=['workspaces:individual-${username}'],
    actions=[
        'workspace:Create*',
        'workspace:Delete*',
        'workspace:Get*',
        'workspace:List*',
        'workspace:Update*',
    ],
    effect='allow',
)

policy = whocan.Policy(statements=[statement])
policy.is_allowed(
    resource='workspaces:individual-my-username',
    action='workspace:DeletePage',
    arguments={'username': 'my-username'},
)
# True
policy.is_allowed(
    resource='workspaces:individual-a-different-user',
    action='workspace:DeletePage',
    arguments={'username': 'my-username'},
)
# False

Metadata

Release files for whocan 0.4.1

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

Source distribution (sdist)

Source distribution for whocan 0.4.1
File Size Uploaded Provenance Actions
whocan-0.4.1.tar.gz 5.9 kB Without provenance Details for whocan-0.4.1.tar.gz

Built distribution (wheel)

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

Total release size: 13.1 kB

Release files / whocan-0.4.1.tar.gz

Download URL whocan-0.4.1.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
031c84467a695f3532500bf0697beced1c8cb73cfd31abe1028f07c8374f2778
BLAKE2b-256 checksum
How to use checksums
6f31bcf06053744f905ea7d23266114fc1422ce890e9a671734f16858694f7b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.12 Linux/6.2.0-35-generic

Release files / whocan-0.4.1-py3-none-any.whl

Download URL whocan-0.4.1-py3-none-any.whl
Size 7.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8a4cc3d574f18345348f62c83384ec72077055a077aac5a9feb9878ff09fcbf0
BLAKE2b-256 checksum
How to use checksums
0bd6dbeb0cf9cda7d8fdfa6eb8677c6dc667cea3b760e8f1720ae0309dcdb165
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.6.1 CPython/3.10.12 Linux/6.2.0-35-generic

Security for whocan 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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