Skip to main content

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.

Metadata

Release files for sqlobject-adapter 0.3.0

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

Source distribution (sdist)

Source distribution for sqlobject-adapter 0.3.0
File Size Uploaded
sqlobject_adapter-0.3.0.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sqlobject-adapter 0.3.0
File Interpreter ABI Platform
sqlobject_adapter-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.3 kB

Release files / sqlobject_adapter-0.3.0.tar.gz

Download URL sqlobject_adapter-0.3.0.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e094d2e3b4e367782a96b2f8f86e4977c874e45d2750690403641d4beb9f74c3
BLAKE2b-256 checksum
How to use checksums
f709010e5836f348258afb822a53d1d8c62a60a152dacf9f836e789056cb1ada
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release files / sqlobject_adapter-0.3.0-py3-none-any.whl

Download URL sqlobject_adapter-0.3.0-py3-none-any.whl
Size 7.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1f5a11e0cfe9744807187e50e2e0ddb7468ddd59de8ac730a0a40b710a461d41
BLAKE2b-256 checksum
How to use checksums
d6767619051d19f97f06db96a7636c707445c71d000602de325787b2b663c0b2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.10

Release history Release notifications | RSS feed

0.5.0

2 release files

0.4.0

2 release files

This release

0.3.0 This release

2 release files

0.2.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