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 casbin_sqlobject_adapter

Simple Example

import casbin_sqlobject_adapter
import casbin

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

casbin_sqlobject_adapter-0.2.0.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

casbin_sqlobject_adapter-0.2.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for casbin_sqlobject_adapter-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d79df01693c853a8e7359afd9f337f2b3aee2c5bbf3b438be1d53dd3967cacf1
MD5 257771dc87772972cc04fba6c382251f
BLAKE2b-256 61d58830bd66bfae8ecd2428354f5daf0471ef8c1f956bf0751190500d7e1264

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for casbin_sqlobject_adapter-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 521a380e9b796f7f0ffe70074b01c6d83585a6845456ce447d344fee1ffa4ee3
MD5 eca3689af0b7212c87396a3ecc479dae
BLAKE2b-256 7e25a53eb967a947a427c212fcf411b834fc5fbc690d356d81f83441024c6821

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