Alternative to admin utilities for more autonomy, targeted towards FastAPI.
Project description
Permissions Systems
It's plugin for fastapi (but can be used with similar frameworks), that provides a minimal
setup for maintaining resources and related permissions for user-groups.
How to use it?
application.py
from fastapi import FastAPI
import databases
import sqlalchemy
import os
from permissions_system.PermissionsSystemDatabases import PermissionsS
app = FastAPI()
DB_URI = os.environ["DB_URI"]
database = databases.Database(DB_URI)
metadata = sqlalchemy.MetaData()
ps = PermissionsS(metadata, database, DB_URI)
app.add_event_handler("startup", startup)
app.add_event_handler("shutdown", shutdown)
async def startup():
await database.connect()
await ps.setup()
Step1 - instantiate PermissionsS class.
Step2 - during startup event after database is connected make a call to setup() _________________________________________________________________________________________
PermissionsS will then detect your tables add them to resources, add super-admin user-group, if there aren't already. Everytime there is a new resource that gets added automatically to resources table. User-group super-admin by default has all CRUD permissions for all resources. To add a new user-group and related permissions use built-in functions add_user_group and add_permissions.
PermissionsSystem is not like django-admin or flask-admin. It doesn't provide a front-end admin dashboard, but a minimal setup to manage resources and permissions. It aims to provide autonomy and more control over to the developer. For front-end you will end up using something more custom or React-admin or vue-element-admin
What's next?
- Provide examples.
- Support for GINO.
- Support for mongoDB (using motor).
- Support for TortoiseORM.
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
Hashes for permissions_system-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c579c5848f731549d05e6f02d315011afd5a60fcb4f2756ca44c1a6f50581f73 |
|
MD5 | bee5cf23ec2f75036f1506dc9cca2e39 |
|
BLAKE2b-256 | 881a3220baa027b32f756d2c9d1b5a8768164adfbce664b1889e8229b9e421ed |