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 Distribution
Built Distribution
Close
Hashes for casbin_couchbase_adapter-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fbdcf1e48ab9f5a642f4afb9a2c687e49bddd9a2233743fdd20dbe7f5981f6d |
|
MD5 | 2dda47f7d2b9075418ceab77847b9d4b |
|
BLAKE2b-256 | e41d7a2415ae8263dba4f8e213b2f861d5943683673255c39d7e0abac9645d43 |
Close
Hashes for casbin_couchbase_adapter-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4f414d9b7af2ca3ea112787d372d5edfbdccd3ef63aaa6cb11163fe0141fd00e |
|
MD5 | 68c409f788d12de2d97810925abb7635 |
|
BLAKE2b-256 | 50b904b34829c543a73f5b13642cd3c1d000c25c51a7895e58e59dc5a180e0da |