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.5.0.tar.gz (7.9 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.5.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqlobject_adapter-0.5.0.tar.gz
  • Upload date:
  • Size: 7.9 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.5.0.tar.gz
Algorithm Hash digest
SHA256 a2f067d728e882d598825d0608a617f1c169a7b1e16175659b686b1eeb2c8777
MD5 882553b1b6a782349c7ebc6f5054e511
BLAKE2b-256 a762bc0d156ffb87dc8a187c311ac2c84b5449d62ab2fdce9b971c38002b7334

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sqlobject_adapter-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87c339595dfd0124ba15a13364564ec0b20e8db78cb73e0227eb1da225c1e775
MD5 de1c54bd275faad1e72a981033d159a2
BLAKE2b-256 7be02550a4c5609fb839ed739df3c95f9e6042f2cea8a684081f7d678b75b6f3

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