Couchbase Adapter for PyCasbin
Couchbase storage adapter for PyCasbin
Installation
pip install casbin_couchbase_adapter
# Create secondary index in Couchbase to support N1QL queries
CREATE INDEX idx_casbin ON content(meta().id, ptype) WHERE meta().id LIKE "casbin_rule%"
Simple Example
import casbin_couchbase_adapter
import casbin
adapter = casbin_couchbase_adapter.Adapter('couchbase://localhost:8091', 'bucket', 'user', 'password')
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 data1
pass
else:
# deny the request, show an error
pass
Development
- Fork
- Install Dev ENV
# Install Flask-Casbin with Dev packages
pip install -r dev_requirements.txt
pip install -r requirements.txt
pip install -e .
# Install Pre-commits
pre-commit install
# Create feature branch
git checkout -b feature-more-cool-stuff
# Code stuff
Then push your changes and create a PR
Manually Bump Version
bumpversion major # major release
or
bumpversion minor # minor release
or
bumpversion patch # hotfix release
Metadata
Release files for casbin-couchbase-adapter 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| casbin_couchbase_adapter-0.3.0-py3-none-any.whl | Python 3 | none | any | Details for casbin_couchbase_adapter-0.3.0-py3-none-any.whl |
Release files / casbin_couchbase_adapter-0.3.0-py3-none-any.whl
| Download URL | casbin_couchbase_adapter-0.3.0-py3-none-any.whl |
|---|---|
| Size | 5.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
86258c76c11434751827cc5e681f7b51189e6bdef4f2876af78ca828c6548edb
|
|
BLAKE2b-256 checksum How to use checksums |
15f0d01c4f566c09d63c6b40e0a8433891da4ed77dfa54404d4c3a4b5d676974
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for casbin-couchbase-adapter 0.3.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.