casbin采用DynamoDB
python-dycasbin的Python项目详细描述
casbin发电机适配器
安装
运行pip install python-dycasbin
使用
import casbin
from python_dycasbin import adapter
adapter = adapter.Adapter(endpoint_url='http://localhost:8000')
e = casbin.Enforcer("model.conf", adapter, True)
sub = "eve4" # the user that wants to access a resource.
obj = "data3" # 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):
print("Allow")
else:
print("Deny")
运行测试
- 安装pytest和{a2}
- 从项目根目录运行
pytest
- 项目
标签: