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.2.0.tar.gz (4.2 MB view details)

Uploaded Source

Built Distribution

sqlobject_adapter-0.2.0-py3-none-any.whl (5.1 MB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: sqlobject_adapter-0.2.0.tar.gz
  • Upload date:
  • Size: 4.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for sqlobject_adapter-0.2.0.tar.gz
Algorithm Hash digest
SHA256 510ce603e7e207ba32660f76707a63ecbf5689032df15d42d7c2990b612b7bdf
MD5 e499c97d546ab7424104d9f4e7f3a381
BLAKE2b-256 334709fe59e00a8e5a5e75cea71e6ec803e067f893858c31fa3e7922c48940d1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for sqlobject_adapter-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18fb1200792090e071e3a63a35e9b8409df5362a9d8eb9d04568825696b4c2f4
MD5 dfea795f6c671e5bbcd79490320e6804
BLAKE2b-256 bcc789837feffb568e1d54d7feedbd4f6e32d35b59c08e6c81a1e26fcd40235d

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