chore(release): 1.2.0 [skip ci]

# [1.2.0](https://github.com/officialpycasbin/pymongo-adapter/compare/v1.1.1...v1.2.0) (2024-11-11)

### Features

* update path ([d389485](https://github.com/officialpycasbin/pymongo-adapter/commit/d38948567df33d4d13198f2fd41ae0eadd0f8035))
2 files changed
tree: da7f20516ef4e697c0fe402ee1fb48c636621fe7
  1. .github/
  2. casbin_pymongo_adapter/
  3. tests/
  4. .coveragerc
  5. .gitignore
  6. .releaserc.json
  7. CHANGELOG.md
  8. LICENSE
  9. README.md
  10. requirements.txt
  11. setup.cfg
  12. setup.py
README.md

PyMongo Adapter for PyCasbin

Build Status Coverage Status Version PyPI - Wheel Pyversions Download License

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.