chore(release): 1.1.0 [skip ci] # [1.1.0](https://github.com/pycasbin/pymongo-adapter/compare/v1.0.0...v1.1.0) (2024-03-29) ### Features * upgrade CI Node.js version to 20 ([e2e48e4](https://github.com/pycasbin/pymongo-adapter/commit/e2e48e456b2c4502e28ae6c58d31183959d66662))
PyMongo Adapter is the PyMongo adapter for PyCasbin. With this library, Casbin can load policy from MongoDB or save policy to it.
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
This project is licensed under the Apache 2.0 license.