PyMongo Adapter for PyCasbin
Project description
PyMongo Adapter for PyCasbin
PyMongo Adapter is the PyMongo adapter for PyCasbin. With this library, Casbin can load policy from MongoDB or save policy to it.
Installation
pip install casbin_pymongo_adapter
Simple Example
import casbin_pymongo_adapter
import casbin
adapter = casbin_pymongo_adapter.Adapter('mongodb://localhost:27017/', "dbname")
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
Built Distribution
File details
Details for the file casbin_pymongo_adapter-1.1.0.tar.gz
.
File metadata
- Download URL: casbin_pymongo_adapter-1.1.0.tar.gz
- Upload date:
- Size: 9.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03ea6f7b1cdf7d82b0de7c942f976fdaa867e08037ab931b009b53bcaa9ee2cd |
|
MD5 | 4c50e4dff9d82ee1b7dd87cac9428d47 |
|
BLAKE2b-256 | 6c8dd816e8a3042511b70bf116e225b7bd15a3379c8b6717ad8468e64646e600 |
File details
Details for the file casbin_pymongo_adapter-1.1.0-py2.py3-none-any.whl
.
File metadata
- Download URL: casbin_pymongo_adapter-1.1.0-py2.py3-none-any.whl
- Upload date:
- Size: 9.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 864c84265332facb46d41987fb441aebdb884730ec9158642e0976901116549f |
|
MD5 | c1eab2fd66baea92f8e746653062d4ad |
|
BLAKE2b-256 | 138c2adc0bef41067a6e69adae569b748830d04db3033c4d542ff88e3835e495 |