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.3.0.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

sqlobject_adapter-0.3.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for sqlobject_adapter-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e094d2e3b4e367782a96b2f8f86e4977c874e45d2750690403641d4beb9f74c3
MD5 80be14a272681768ecc38ac93a7e0a4b
BLAKE2b-256 f709010e5836f348258afb822a53d1d8c62a60a152dacf9f836e789056cb1ada

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for sqlobject_adapter-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f5a11e0cfe9744807187e50e2e0ddb7468ddd59de8ac730a0a40b710a461d41
MD5 65302cbfbc393c79259e56d1b26161bf
BLAKE2b-256 d6767619051d19f97f06db96a7636c707445c71d000602de325787b2b663c0b2

See more details on using hashes here.

Provenance

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