Two-layer RBAC (system + company) helpers for FastAPI / Flask / any Python backend — paired with the snipe-auth-rbac TS sibling.
Project description
snipe-auth-rbac
Python sibling of snipe-auth-rbac.
Two-layer RBAC (system + per-company roles) for FastAPI / Flask /
any Python backend.
See the top-level README for the full picture and the adoption guide for everyday usage.
Install
pip install "snipe-auth-rbac[fastapi]"
Three-line FastAPI integration
from auth_rbac import PermissionsService, ResourceDescriptor
from auth_rbac.deps import (
configure_auth_rbac,
require_permission,
active_company_middleware,
)
service = PermissionsService(supabase=supabase, resources=RESOURCES)
service.sync_resources() # auto-sync the registry on every boot
configure_auth_rbac(service=service, user_id_resolver=resolve_user_id)
app.middleware("http")(active_company_middleware)
@app.get("/payments")
async def list_payments(_=Depends(require_permission("payments", "read"))):
...
The Supabase migration that defines the rbac schema (tables +
resolver functions) ships under sql/ in the parent repo — apply
it once, and add rbac to your project's PostgREST exposed-schemas
list before the first boot.
License
MIT.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file snipe_auth_rbac-0.2.0.tar.gz.
File metadata
- Download URL: snipe_auth_rbac-0.2.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1ce1322ed38966b17c9e96fba74e9f87aee73609079e997a8b264ee2bc08a3e4
|
|
| MD5 |
49e5835e17589ea13928560735588c88
|
|
| BLAKE2b-256 |
ac6d7b6ed43fb2fe64b47d6b825be97e7ce3b0843ef15934c0cf88f376281b9e
|
File details
Details for the file snipe_auth_rbac-0.2.0-py3-none-any.whl.
File metadata
- Download URL: snipe_auth_rbac-0.2.0-py3-none-any.whl
- Upload date:
- Size: 11.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d9867944e7d6ccce0f0ab19a27df14c8d3322bb8c3a349e0196766551b2eff6
|
|
| MD5 |
6c0ae0afbcb24f8c6d29e61366bfa7ca
|
|
| BLAKE2b-256 |
1538e4761cfa39c6e8627193c7a2d833924b3ec727a0e083412cc07b624b70fb
|