RBAC primitives — roles, permissions, @require_permission decorator, admin UI for simple_module
Project description
simple_module_permissions
Role-based access control (RBAC) for simple_module apps. Users get roles, roles carry permissions, and route handlers declare required permissions at the decorator or dependency layer.
Pre-wired into any app scaffolded with simple-module new.
Install
pip install simple_module_permissions
What it provides
RoleandPermissionSQLModel tables, seeded from module-registered defaults.@require_permission("orders.read")route decorator andHasPermission("...")dependency.- Admin UI at
/permissions/adminfor assigning roles to users. register_permissions()hook — every module declares its permission strings at boot, the registry dedupes and persists them.
Usage
Declare permissions at module boot:
# modules/orders/orders/module.py
class OrdersModule(ModuleBase):
meta = ModuleMeta(name="orders")
def register_permissions(self):
return ["orders.read", "orders.write"]
Guard a route:
from fastapi import APIRouter, Depends
from permissions.deps import HasPermission # type: ignore[import-not-found]
router = APIRouter()
@router.get("/orders", dependencies=[Depends(HasPermission("orders.read"))])
async def list_orders(): ...
Admin flow: navigate to /permissions/admin, create a role, assign permissions, assign the role to users.
Depends on
simple_module_core,simple_module_db,simple_module_hosting,simple_module_users
License
MIT — see LICENSE.
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 simple_module_permissions-0.0.2.tar.gz.
File metadata
- Download URL: simple_module_permissions-0.0.2.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2e1f52ff1f4dced4eed93f963e4238d98820b2a5b23e2566fffa46494240ec8c
|
|
| MD5 |
d478ec92f6cdce473535b072f8587750
|
|
| BLAKE2b-256 |
8e5567088248c813397cee32dacb568d1b222c7a4ed052949a61dbbef3c2a960
|
Provenance
The following attestation bundles were made for simple_module_permissions-0.0.2.tar.gz:
Publisher:
release.yml on antosubash/simple_module_python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_module_permissions-0.0.2.tar.gz -
Subject digest:
2e1f52ff1f4dced4eed93f963e4238d98820b2a5b23e2566fffa46494240ec8c - Sigstore transparency entry: 1391727890
- Sigstore integration time:
-
Permalink:
antosubash/simple_module_python@1a7e639ff44ab1e2ebf917e0a7f7148e947ca085 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/antosubash
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1a7e639ff44ab1e2ebf917e0a7f7148e947ca085 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file simple_module_permissions-0.0.2-py3-none-any.whl.
File metadata
- Download URL: simple_module_permissions-0.0.2-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8bcc908608cb44dbfb7a999f0c9a822d5686d6f7d8a6809c5d76a8257b8318ff
|
|
| MD5 |
7d7ffee01ed523948dc7b4b4ba0cc0ae
|
|
| BLAKE2b-256 |
1b7dd3240e6e6a81ee70ff9627d64fc32519cff5d2dc8591ca7a4544aa3423b0
|
Provenance
The following attestation bundles were made for simple_module_permissions-0.0.2-py3-none-any.whl:
Publisher:
release.yml on antosubash/simple_module_python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_module_permissions-0.0.2-py3-none-any.whl -
Subject digest:
8bcc908608cb44dbfb7a999f0c9a822d5686d6f7d8a6809c5d76a8257b8318ff - Sigstore transparency entry: 1391727897
- Sigstore integration time:
-
Permalink:
antosubash/simple_module_python@1a7e639ff44ab1e2ebf917e0a7f7148e947ca085 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/antosubash
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1a7e639ff44ab1e2ebf917e0a7f7148e947ca085 -
Trigger Event:
workflow_dispatch
-
Statement type: