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.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| litestar_permissions-0.1.3.tar.gz | 10.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| litestar_permissions-0.1.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 21.6 kB
Release files / litestar_permissions-0.1.3.tar.gz
| Download URL | litestar_permissions-0.1.3.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
7d8d97a154569c5e6ceb1b7ebd524f93a0d18b3f20348c7902bc285df8a19123
|
|
BLAKE2b-256 checksum How to use checksums |
8ba600fed455189d922457824c594a672ece08013957bafbf69183e4a078cc5a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
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 Feb 27, 2026.
Transparency logRelease files / litestar_permissions-0.1.3-py3-none-any.whl
| Download URL | litestar_permissions-0.1.3-py3-none-any.whl |
|---|---|
| Size | 11.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ff63c0c773a5bb21b624fb0a0bcb16b6e59cc825581c8e830e4365df5c8d2619
|
|
BLAKE2b-256 checksum How to use checksums |
e1066c6f1ca3ef57a581fb2b6e8483005b7db6965c4e796a33ff843272d649d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
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 Feb 27, 2026.
Transparency log