Couchbase Adapter for PyCasbin
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
File details
Details for the file casbin_couchbase_adapter-0.1.4-py3-none-any.whl
.
File metadata
- Download URL: casbin_couchbase_adapter-0.1.4-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.24.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8292f94993fb73e0e1b5769080e2dbb4009a1df549adafcbc1f42e110aa788c0 |
|
MD5 | 0e72a463e9e5379d068f0acd9ed94149 |
|
BLAKE2b-256 | 19e8e2fd3a739b9f135f4c14779c1614139556020e5fc18e1b2a768ccbe0def1 |