This release is a pre-release and may not be stable for production use.
forge-mvc-rbac
Module RBAC officiel pour Forge : rôles, permissions, décorateurs et helpers Jinja.
Installation
pip install forge-mvc-rbac
Usage
Modèles
from forge_mvc_rbac import Role, Permission, normalize_role_slug, normalize_permission_code
slug = normalize_role_slug("Super Admin") # "super-admin"
code = normalize_permission_code("Posts Edit") # "posts.edit"
role = Role(id=None, name="Super Admin", slug=slug)
perm = Permission(id=None, code=code)
Décorateurs serveur (session legacy)
from forge_mvc_rbac import require_permission
@staticmethod
@require_permission("posts.edit")
def edit(request): ...
Décorateurs serveur (Auth/User)
from forge_mvc_rbac import require_user_permission
@staticmethod
@require_user_permission("posts.edit")
def edit(request): ...
Helper Jinja
from forge_mvc_rbac import make_auth_jinja_context
# Dans BaseController.render(), injecté automatiquement
ctx.update(make_auth_jinja_context(request))
Template :
{% if can("posts.edit") %}<a href="...">Modifier</a>{% endif %}
{% if is_authenticated %}Bonjour {{ current_user.id }}{% endif %}
SQL
- La table pivot
user_roles(liaisonusers↔roles) est générée dans votre projet par la commande du coreforge auth:init, puis appliquée avecforge db:apply. Elle est rendue pour le backend installé. - Les tables
roles,permissions,role_permissionssont générées parforge rbac:init, puis appliquées avecforge migration:apply. Elles sont rendues pour le backend installé, comme le reste du provisioning Forge.
Le fichier sql/rbac.sql du dépôt source n'est plus qu'une référence
historique : il n'est pas livré dans le wheel et n'est lu par aucun code.
La source de vérité est la déclaration forge_mvc_rbac.tables.
Limites
- Pas de hiérarchie de rôles
- Pas de multi-tenant
- Toutes les permissions sont définies en base
Metadata
Release files for forge-mvc-rbac 1.0.0rc9
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 |
|---|---|---|---|---|
| forge_mvc_rbac-1.0.0rc9.tar.gz | 48.9 kB | Without provenance | Details for forge_mvc_rbac-1.0.0rc9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| forge_mvc_rbac-1.0.0rc9-py3-none-any.whl | Python 3 | none | any | Details for forge_mvc_rbac-1.0.0rc9-py3-none-any.whl |
Total release size: 94.2 kB
Release files / forge_mvc_rbac-1.0.0rc9.tar.gz
| Download URL | forge_mvc_rbac-1.0.0rc9.tar.gz |
|---|---|
| Size | 48.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0ff4345ba55ee1d4107dc0f14d5a195d4d075f3d307919013653ab77a9044411
|
|
BLAKE2b-256 checksum How to use checksums |
a8ecb9112093752dc6a081455706e3b6b8b99ced3f6b90bf103a9dc74f56c581
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / forge_mvc_rbac-1.0.0rc9-py3-none-any.whl
| Download URL | forge_mvc_rbac-1.0.0rc9-py3-none-any.whl |
|---|---|
| Size | 45.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d633265ad155cd5447042fd6047db6b4d9c8e4761d66fb3462b92f8f1d063f86
|
|
BLAKE2b-256 checksum How to use checksums |
99e208ac16b4f805e648a1467032fb404a5a97aabcdaea4345c8917f74f8724a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for forge-mvc-rbac 1.0.0rc9
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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.