Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/officialpycasbin/pymongo-adapter
PyMongo Adapter for PyCasbin
https://github.com/officialpycasbin/pymongo-adapter
abac acl adapter auth authorization authz casbin db mongo mongodb pycasbin pymongo python rbac
Last synced: about 2 months ago
JSON representation
PyMongo Adapter for PyCasbin
- Host: GitHub
- URL: https://github.com/officialpycasbin/pymongo-adapter
- Owner: officialpycasbin
- License: apache-2.0
- Created: 2024-11-11T17:24:24.000Z (about 2 months ago)
- Default Branch: master
- Last Pushed: 2024-11-11T17:33:09.000Z (about 2 months ago)
- Last Synced: 2024-11-11T18:28:23.959Z (about 2 months ago)
- Topics: abac, acl, adapter, auth, authorization, authz, casbin, db, mongo, mongodb, pycasbin, pymongo, python, rbac
- Language: Python
- Homepage: https://github.com/casbin/pycasbin
- Size: 31.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
PyMongo Adapter for PyCasbin
====[![Build Status](https://www.travis-ci.org/officialpycasbin/pymongo-adapter.svg?branch=master)](https://www.travis-ci.org/officialpycasbin/pymongo-adapter)
[![Coverage Status](https://coveralls.io/repos/github/officialpycasbin/pymongo-adapter/badge.svg)](https://coveralls.io/github/officialpycasbin/pymongo-adapter)
[![Version](https://img.shields.io/pypi/v/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)
[![PyPI - Wheel](https://img.shields.io/pypi/wheel/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)
[![Pyversions](https://img.shields.io/pypi/pyversions/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)
[![Download](https://img.shields.io/pypi/dm/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)
[![License](https://img.shields.io/pypi/l/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)PyMongo Adapter is the [PyMongo](https://pypi.org/project/pymongo/) adapter for [PyCasbin](https://github.com/casbin/pycasbin). With this library, Casbin can load policy from MongoDB or save policy to it.
## Installation
```
pip install casbin_pymongo_adapter
```## Simple Example
```python
import casbin_pymongo_adapter
import casbinadapter = 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
- [PyCasbin](https://github.com/casbin/pycasbin)
### License
This project is licensed under the [Apache 2.0 license](LICENSE).