Skip to main content

SQLAlchemy Adapter for PyCasbin

Project description

SQLAlchemy Adapter for PyCasbin

Build Status Coverage Status Version PyPI - Wheel Pyversions Download License

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

Based on Officially Supported Databases, The current supported databases are:

  • PostgreSQL
  • MySQL
  • SQLite
  • Oracle
  • Microsoft SQL Server
  • Firebird
  • Sybase

Installation

pip install casbin_sqlalchemy_adapter

Simple Example

import casbin_sqlalchemy_adapter
import casbin

adapter = casbin_sqlalchemy_adapter.Adapter('sqlite:///test.db')

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

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

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

casbin_sqlalchemy_adapter-0.2.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file casbin_sqlalchemy_adapter-0.2.0.tar.gz.

File metadata

  • Download URL: casbin_sqlalchemy_adapter-0.2.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.7

File hashes

Hashes for casbin_sqlalchemy_adapter-0.2.0.tar.gz
Algorithm Hash digest
SHA256 11a2371c79b788b8dc405b5ce189109b2910d1a06b6e314b570283edeb4cc240
MD5 ef61e598726d3d82bafe4870b3b40e38
BLAKE2b-256 f99bf99e4b462ceae31cc6a3515e4ae39c13785cae5315569853c1a49405bd2a

See more details on using hashes here.

File details

Details for the file casbin_sqlalchemy_adapter-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: casbin_sqlalchemy_adapter-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 9.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/51.1.2 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.6.7

File hashes

Hashes for casbin_sqlalchemy_adapter-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 26d54858e5a99c90ae94ea4640650a07d042332de580b2fb193482b55e9d6563
MD5 e46e83a77bcfa1fa4603693ffac3574b
BLAKE2b-256 678d7bbd3e61bf5a6a6d26826675b67fbdccc96c2f07a56c52b03826234f641a

See more details on using hashes here.

Supported by

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