Skip to main content

rbac2fast-core

🚀 Core abstract package for Role-Based Access Control (RBAC) in Python/FastAPI. Contains Protocols and Pydantic schemas without database logic.

📖 Conventions reference: this package follows the 2fast-handbook for ecosystem conventions (structure, versioning, README, commits, release).

Features

  • 🧩 Abstract Interfaces: Defines standard Protocols for RBAC models and services.
  • 📦 Pydantic Schemas: Pre-defined base models for validation and serialization of Roles, Permissions, Routes, and Assignments.
  • 🪶 Lightweight: Zero database dependencies; relies solely on standard Python abstractions and pydantic.
  • 🔌 Pluggable Architecture: Allows multiple concrete implementations (e.g., standard global RBAC or multi-tenant RBAC) to share a standardized API contract.

Installation

pip install rbac2fast-core

Breaking changes

0.2.0 — UUID identifiers

All schema identifiers (id, permission_category_id, permission_id, route_id, user_id, role_id, entity_id) are now UUID instead of int. Consumers that build payloads with integer ids must convert them to UUID strings, or upgrade to permissions2fast-fastapi >= 0.12.2, which ships the matching models and migrations.

Structure

This package exposes abstract definitions that concrete implementations (like permissions2fast-fastapi) will fulfill.

Protocols (rbac2fast_core.protocols)

Defines minimal structural requirements that underlying models must fulfill:

  • RoleProtocol, PermissionProtocol, RouteProtocol ...

Schemas (rbac2fast_core.schemas)

Provides validation schemas:

  • RoleBase, RoleCreate, RoleRead
  • PermissionBase, PermissionCreate ...

Usage

This package is not meant to be used standalone to handle permissions, but rather to be imported as a dependency by actual implementation packages or application layers that need to adhere to the standard RBAC design.

Example of implementing a protocol in your ORM model:

from sqlmodel import SQLModel, Field
from rbac2fast_core.protocols.models import RoleProtocol

class Role(SQLModel, table=True):
    # This class structurally fulfills RoleProtocol
    id: int | None = Field(default=None, primary_key=True)
    name: str = Field(unique=True, index=True)
    description: str | None = None
    is_active: bool = True

License

This project is licensed under the MIT License - see the LICENSE file for details.

Copyright (c) 2026 Angel Daniel Sanchez Castillo

Metadata

Release files for rbac2fast-core 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rbac2fast-core 0.2.0
File Size Uploaded Provenance Actions
rbac2fast_core-0.2.0.tar.gz 8.5 kB Without provenance Details for rbac2fast_core-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for rbac2fast-core 0.2.0
File Interpreter ABI Platform Actions
rbac2fast_core-0.2.0-py3-none-any.whl Python 3 none any Details for rbac2fast_core-0.2.0-py3-none-any.whl

Total release size: 17.1 kB

Release files / rbac2fast_core-0.2.0.tar.gz

Download URL rbac2fast_core-0.2.0.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
7a07c51ebeed1567f2b30929f4ac886d6048f28ffb357c72d824179673fe462a
BLAKE2b-256 checksum
How to use checksums
faffa4661f02460b583979b142c73795e4b70ece9141218d76d5f74962a22499
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Release files / rbac2fast_core-0.2.0-py3-none-any.whl

Download URL rbac2fast_core-0.2.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ba9cd5ec7e67487596668ae5a21a5c27600e5a1eee5c070370067fc7341790b4
BLAKE2b-256 checksum
How to use checksums
66e6fdbe3159402afbece7318ac94ae43e6be12c5f5bf3f8f9a79830e33f0651
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.10

Security for rbac2fast-core 0.2.0

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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page