PyCasbin的PyMongo适配器
项目描述
PyCasbin的PyMongo适配器
PyMongo适配器是PyMongo的适配器,用于PyCasbin。使用这个库,Casbin可以从MongoDB加载策略或将其保存到MongoDB。
安装
pip install casbin_pymongo_adapter
简单示例
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
获取帮助
许可证
本项目采用Apache 2.0许可证。
项目详情
下载文件
下载您平台上的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。
源代码发行版
casbin_pymongo_adapter-1.1.0.tar.gz (9.2 kB 查看哈希值)
构建发行版
关闭
casbin_pymongo_adapter-1.1.0.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 03ea6f7b1cdf7d82b0de7c942f976fdaa867e08037ab931b009b53bcaa9ee2cd |
|
MD5 | 4c50e4dff9d82ee1b7dd87cac9428d47 |
|
BLAKE2b-256 | 6c8dd816e8a3042511b70bf116e225b7bd15a3379c8b6717ad8468e64646e600 |
关闭
casbin_pymongo_adapter-1.1.0-py2.py3-none-any.whl的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 864c84265332facb46d41987fb441aebdb884730ec9158642e0976901116549f |
|
MD5 | c1eab2fd66baea92f8e746653062d4ad |
|
BLAKE2b-256 | 138c2adc0bef41067a6e69adae569b748830d04db3033c4d542ff88e3835e495 |