litestar-permissions
Fine-grained hierarchical RBAC for Litestar applications.
Roles are scoped to resources and permissions inherit upward through the hierarchy. An org-admin role on Organization X grants those permissions on every project and application inside it. Built on SQLAlchemy 2.x, ships as a Litestar plugin.
Installation
uv add litestar-permissions
Quick Start
from litestar import Litestar, get
from litestar_permissions import PermissionsPlugin, PermissionsConfig, require_permission
from sqlalchemy.orm import DeclarativeBase
class Base(DeclarativeBase):
pass
config = PermissionsConfig(
hierarchy={"application": "project", "project": "organization"},
)
@get(
"/apps/{app_id:str}/deploy",
guards=[require_permission("application:deploy", resource_id_param="app_id")],
)
async def deploy(app_id: str) -> dict:
return {"status": "deploying"}
app = Litestar(
route_handlers=[deploy],
plugins=[PermissionsPlugin(config=config, base=Base)],
)
The plugin generates four SQLAlchemy tables (roles, permissions, role_permissions, user_role_assignments) bound to your Base. Guards check permissions at the resource scope, walking up the hierarchy to find matching role assignments.
How the Hierarchy Works
Define parent-child relationships between resource types:
PermissionsConfig(
hierarchy={
"application": "project", # application's parent is project
"project": "organization", # project's parent is organization
}
)
When checking application:deploy on a specific app, the resolver checks role assignments scoped to that app, then its parent project, then the parent org, then global. A match at any level grants the permission.
Development
make dev # install with all dev deps
make test # run tests
make lint # run prek hooks (ruff, ty, codespell)
make docs-serve # live-reload docs on localhost:8001
Documentation
Full docs at jacobcoffee.github.io/litestar-permissions.
License
MIT - see LICENSE.
Metadata
Release files for litestar-permissions 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| litestar_permissions-0.1.4.tar.gz | 11.4 kB | With provenance | Details for litestar_permissions-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| litestar_permissions-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for litestar_permissions-0.1.4-py3-none-any.whl |
Total release size: 23.0 kB
Release files / litestar_permissions-0.1.4.tar.gz
| Download URL | litestar_permissions-0.1.4.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3024369a648b2562ba29886395b7c54d76a1805316f6a112996be2ea66aa9d6f
|
|
BLAKE2b-256 checksum How to use checksums |
e4a21e1dc2c6660089f1955b4d8778c92aff7eb197c32b960dc168ec1022bb8b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Oct 11, 2026.
Transparency logRelease files / litestar_permissions-0.1.4-py3-none-any.whl
| Download URL | litestar_permissions-0.1.4-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5c54fa28cb9764e4bab723cd20b354065282af03b5787b6b944b45bfa712f2f2
|
|
BLAKE2b-256 checksum How to use checksums |
3e276bf90cf86b60dc95fcfdff0f0c4cc640d280e7b53df984c93d62d81c3ce8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.13
|
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 Oct 11, 2026.
Transparency logSecurity for litestar-permissions 0.1.4
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.
Attestation for litestar_permissions-0.1.4.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 Oct 11, 2026.
Transparency logA 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.