Permissions Systems
It's plugin for fastapi (but can be used with similar frameworks) any 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()
ps.setup()
for Flask app you will call ps.setup() after db.init(app), assuming you are using flask_sqlalchemy
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 isn't already one. 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. To get whether a particular user has CRUD permissions for a particular resource you will call > ps.user_has_permissions(user_id:UUID,resource:str,permission_type:PermissionTypesEnum) -> bool*
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
Find an example here, to learn how it can be used.
PermissionsSystem now only uses sqlalchemy and is completely sync.
Release files for permissions-system 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| permissions-system-0.2.3.tar.gz | 9.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| permissions_system-0.2.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 24.1 kB
Release files / permissions-system-0.2.3.tar.gz
| Download URL | permissions-system-0.2.3.tar.gz |
|---|---|
| Size | 9.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
683bd4f49c5aa553f59d1c84cffb7b7c8d88bba78ea10060eb240cf6c43e35c7
|
|
BLAKE2b-256 checksum How to use checksums |
8be7fa6484c47e451e5034351bae73b3bd279017c9404e0209b4e885d76aee4c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
|
Release files / permissions_system-0.2.3-py3-none-any.whl
| Download URL | permissions_system-0.2.3-py3-none-any.whl |
|---|---|
| Size | 14.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
db1b6d9fe41c8db76bbf6a7a44b04f03f3dc6eb6e8be25cada30d32a37517520
|
|
BLAKE2b-256 checksum How to use checksums |
d6a64b92f0758a6bf3f1cac0f637a1b1b2b4b71e9dd28d8f0adc492de536868a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.2
|