Skip to main content

Fibase Adapter for PyCasbin

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pycasbin_firebase_adapter-0.0.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

pycasbin_firebase_adapter-0.0.1-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

Details for the file pycasbin_firebase_adapter-0.0.1.tar.gz.

File metadata

  • Download URL: pycasbin_firebase_adapter-0.0.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pycasbin_firebase_adapter-0.0.1.tar.gz
Algorithm Hash digest
SHA256 66b5b3de3481871d37e55ebda027fba009994efb1567c45cd4793919e4269c2c
MD5 e525eba4136de39434bb55efc26342a1
BLAKE2b-256 181c0e748c3952f650f7ff74f8d8079ebdda27a2a6f322b0256858f749abbf24

See more details on using hashes here.

File details

Details for the file pycasbin_firebase_adapter-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pycasbin_firebase_adapter-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pycasbin_firebase_adapter-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 faf08563d9016a30f85f863650c01c036c415ec12f5e229f68843fb66a2480c1
MD5 7efd75de91dcea246cc015be9a079492
BLAKE2b-256 a54817ddfcd2fd8df9c9bcc98646bebc4734c5251f9e6f5dd4d1d6056853a5e5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page