Skip to main content

Firebase Adapter for PyCasbin

Firebase Adapter is the Firebase adapter for PyCasbin. With this library, Casbin can load policy from Firebase Firestore or save policy to it.

Installation

pip install pycasbin_firebase_adapter

Simple Example

import pycasbin_firebase_adapter
import casbin

adapter = pycasbin_firebase_adapter.Adapter('path/to/services.json')

e = casbin.Enforcer('path/to/model.conf', adapter)

sub = "alice"  # the user that wants to access a resource.
obj = "data1"  # the resource that is going to be accessed.
act = "read"  # the operation that the user performs on the resource.

if e.enforce(sub, obj, act):
    # permit alice to read data1casbin_sqlalchemy_adapter
    pass
else:
    # deny the request, show an error
    pass

Credits

Based on sqlalchemy-adapter

Getting Help

License

This project is licensed under the Apache 2.0 license.

Release files for pycasbin-firebase-adapter 0.0.1

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

Source distribution (sdist)

Source distribution for pycasbin-firebase-adapter 0.0.1
File Size Uploaded
pycasbin_firebase_adapter-0.0.1.tar.gz 3.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pycasbin-firebase-adapter 0.0.1
File Interpreter ABI Platform
pycasbin_firebase_adapter-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 12.3 kB

Release files / pycasbin_firebase_adapter-0.0.1.tar.gz

Download URL pycasbin_firebase_adapter-0.0.1.tar.gz
Size 3.5 kB
Tags Source
SHA-256 checksum
How to use checksums
66b5b3de3481871d37e55ebda027fba009994efb1567c45cd4793919e4269c2c
BLAKE2b-256 checksum
How to use checksums
181c0e748c3952f650f7ff74f8d8079ebdda27a2a6f322b0256858f749abbf24
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release files / pycasbin_firebase_adapter-0.0.1-py3-none-any.whl

Download URL pycasbin_firebase_adapter-0.0.1-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
faf08563d9016a30f85f863650c01c036c415ec12f5e229f68843fb66a2480c1
BLAKE2b-256 checksum
How to use checksums
a54817ddfcd2fd8df9c9bcc98646bebc4734c5251f9e6f5dd4d1d6056853a5e5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.0.1 This release

2 release files

0.0.0

2 release files

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