Metadata-Version: 2.4
Name: rbac2fast-core
Version: 0.1.0
Summary: Core design package for RBAC: protocols and pydantic schemas
Author-email: Angel Daniel Sanchez Castillo <angeldaniel.sanchezcastillo@gmail.com>
License: MIT License
        
        Copyright (c) 2026 Angel Daniel Sanchez Castillo
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Project-URL: Homepage, https://github.com/AngelDanielSanchezCastillo/rbac2fast-core
Project-URL: Repository, https://github.com/AngelDanielSanchezCastillo/rbac2fast-core
Project-URL: Issues, https://github.com/AngelDanielSanchezCastillo/rbac2fast-core/issues
Keywords: permissions,rbac,authorization,access control
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Framework :: FastAPI
Classifier: Topic :: Security
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pydantic>=2.0
Dynamic: license-file

# rbac2fast-core

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

> [!WARNING]
> **Internal Use Notice**
> 
> This package is designed and maintained by the **Solautyc Team** for internal use. While it is publicly available, it may not work as expected in all environments or use cases outside of our specific infrastructure. We do not provide support or guarantees for external usage, and we are not responsible for any issues that may arise from using this package in other contexts.
> 
> Use at your own risk. Contributions and feedback are welcome, but compatibility with external environments is not guaranteed.

## 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

```bash
pip install rbac2fast-core
```

## 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:

```python
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](LICENSE) file for details.

Copyright (c) 2026 Angel Daniel Sanchez Castillo
