Skip to main content

panda-authz

Reusable authorization library for PanDA WMS services built on top of PyCasbin.

panda-authz provides:

  • A shared Casbin model
  • Standard matcher functions
  • File-based policy loading
  • A simple AuthorizationService API
  • Reusable authorization logic across multiple PanDA WMS components

Installation

pip install panda-authz

Quick Start

Create a policy file, more about the policy format in the documentation:

# policy.csv
p, panda, user_contact, read, {}, {}, allow
p, panda, task, update, {"tasktype": "prod"}, {"priority": [500, 999]}, allow

Create and use the authorization service:

from panda_authz.service import AuthorizationService
authz = AuthorizationService("policy.csv")
allowed = authz.enforce(
    ["panda"],
    "user_contact",
    "read",
    {},
    {},
)

print(allowed)  # True

more examples in the documentation.

Django Integration

# oauth/authz.py
from django.conf import settings
from panda_authz.service import AuthorizationService
authz = AuthorizationService(settings.AUTHZ_POLICY_FILE_PATH)

Then use it in views or service code:

from oauth.authz import authz
if not authz.enforce(
    request.user_roles,
    "user_contact",
    "read",
    {},
    {},
):
    raise PermissionDenied()

Metadata

Release files for panda-authz 2.0.0

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

Source distribution (sdist)

Source distribution for panda-authz 2.0.0
File Size Uploaded Provenance Actions
panda_authz-2.0.0.tar.gz 8.1 kB With provenance Details for panda_authz-2.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for panda-authz 2.0.0
File Interpreter ABI Platform Actions
panda_authz-2.0.0-py3-none-any.whl Python 3 none any Details for panda_authz-2.0.0-py3-none-any.whl

Total release size: 16.3 kB

Release files / panda_authz-2.0.0.tar.gz

Download URL panda_authz-2.0.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
b4072dda766c9e5d686ce1b327ee55d7fd4e22245b4e7b4e37400b71d9014748
BLAKE2b-256 checksum
How to use checksums
0b65e1e7b36c4edf268d2c6d67bbdcc25a8f88d3b742c0d257770718d3967341
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

Release files / panda_authz-2.0.0-py3-none-any.whl

Download URL panda_authz-2.0.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aaa47b9c58966cf01e817cca37292946f632e23652625c4986fb5ab03fee1b61
BLAKE2b-256 checksum
How to use checksums
05a8e1807a2effc085dc57e80ed035df77dc18999bba3989bf5b5da235dea16c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

Security for panda-authz 2.0.0

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for panda_authz-2.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on May 7, 2026.

Transparency log

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