Skip to main content

SQLObject Adapter for PyCasbin

Project description

SQLObject Adapter for PyCasbin

GitHub Action Coverage Status Version PyPI - Wheel Pyversions Download License

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

The current supported databases are:

  • PostgreSQL
  • MySQL
  • SQLite
  • Microsoft SQL Server
  • Firebird
  • Sybase
  • MAX DB
  • pyfirebirdsql

Installation

pip install sqlobject_adapter

Simple Example

import sqlobject_adapter
import casbin

adapter = sqlobject_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

sqlobject_adapter-0.4.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sqlobject_adapter-0.4.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

Details for the file sqlobject_adapter-0.4.0.tar.gz.

File metadata

  • Download URL: sqlobject_adapter-0.4.0.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.13

File hashes

Hashes for sqlobject_adapter-0.4.0.tar.gz
Algorithm Hash digest
SHA256 a51d051e3295b1920c4ff88bbf23560a4c04f2280d78c3b66d81927f3c34d4fc
MD5 d2309097f600312306ae696b3eecd387
BLAKE2b-256 2f706ecd3ca749b4df12a87784e64ac45ca69d1a6df509b64a1059de7e0c48f5

See more details on using hashes here.

File details

Details for the file sqlobject_adapter-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for sqlobject_adapter-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 437812967bddee9ca09434fad0f0005baab8c5321b437c9d19eec3490ad52340
MD5 d55a1f78a8feea4839dd58f289f3fd54
BLAKE2b-256 430d59daa108573062d22e09af35621063db870781b814dc07afc98db9e3b694

See more details on using hashes here.

Supported by

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