casbin-pymongo-adapter


Namecasbin-pymongo-adapter JSON
Version 0.1.0 PyPI version JSON
download
home_pagehttps://github.com/pycasbin/pymongo-adapter
SummaryPyMongo Adapter for PyCasbin
upload_time2021-06-06 09:01:38
maintainer
docs_urlNone
authorTechLee,Xhy-5000,AmosChenYQ
requires_python>=3.6
licenseApache 2.0
keywords casbin pymongo casbin-adapter rbac access control abac acl permission
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            PyMongo Adapter for PyCasbin
====

[![Build Status](https://www.travis-ci.org/pycasbin/pymongo-adapter.svg?branch=master)](https://www.travis-ci.org/pycasbin/pymongo-adapter)
[![Coverage Status](https://coveralls.io/repos/github/pycasbin/pymongo-adapter/badge.svg)](https://coveralls.io/github/pycasbin/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 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

- [PyCasbin](https://github.com/casbin/pycasbin)

### License

This project is licensed under the [Apache 2.0 license](LICENSE).



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pycasbin/pymongo-adapter",
    "name": "casbin-pymongo-adapter",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "casbin,pymongo,casbin-adapter,rbac,access control,abac,acl,permission",
    "author": "TechLee,Xhy-5000,AmosChenYQ",
    "author_email": "techlee@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/f1/9a/b02ec31d6e5ab94222b965bf224e5c98cd118ad53b8b9ff3ef2035ce25f9/casbin_pymongo_adapter-0.1.0.tar.gz",
    "platform": "",
    "description": "PyMongo Adapter for PyCasbin\n====\n\n[![Build Status](https://www.travis-ci.org/pycasbin/pymongo-adapter.svg?branch=master)](https://www.travis-ci.org/pycasbin/pymongo-adapter)\n[![Coverage Status](https://coveralls.io/repos/github/pycasbin/pymongo-adapter/badge.svg)](https://coveralls.io/github/pycasbin/pymongo-adapter)\n[![Version](https://img.shields.io/pypi/v/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)\n[![Pyversions](https://img.shields.io/pypi/pyversions/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)\n[![Download](https://img.shields.io/pypi/dm/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)\n[![License](https://img.shields.io/pypi/l/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)\n\nPyMongo 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.\n\n## Installation\n\n```\npip install casbin_pymongo_adapter\n```\n\n## Simple Example\n\n```python\nimport casbin_pymongo_adapter\nimport casbin\n\nadapter = casbin_pymongo_adapter.Adapter('mongodb://localhost:27017/', \"dbname\")\n\ne = casbin.Enforcer('path/to/model.conf', adapter, True)\n\nsub = \"alice\"  # the user that wants to access a resource.\nobj = \"data1\"  # the resource that is going to be accessed.\nact = \"read\"  # the operation that the user performs on the resource.\n\nif e.enforce(sub, obj, act):\n    # permit alice to read data1casbin_sqlalchemy_adapter\n    pass\nelse:\n    # deny the request, show an error\n    pass\n```\n\n\n### Getting Help\n\n- [PyCasbin](https://github.com/casbin/pycasbin)\n\n### License\n\nThis project is licensed under the [Apache 2.0 license](LICENSE).\n\n\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "PyMongo Adapter for PyCasbin",
    "version": "0.1.0",
    "split_keywords": [
        "casbin",
        "pymongo",
        "casbin-adapter",
        "rbac",
        "access control",
        "abac",
        "acl",
        "permission"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "a0251350da925db70a72199ec034add5",
                "sha256": "d4a6db4ddada32c40a24c1726e666718927b0c3dab9604ab3d241be8da69d32d"
            },
            "downloads": -1,
            "filename": "casbin_pymongo_adapter-0.1.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a0251350da925db70a72199ec034add5",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 8481,
            "upload_time": "2021-06-06T09:01:37",
            "upload_time_iso_8601": "2021-06-06T09:01:37.230790Z",
            "url": "https://files.pythonhosted.org/packages/c3/b4/7488bc77b0fd4e1295c143efe5293ebf30443e676360a97d37a41acadf4e/casbin_pymongo_adapter-0.1.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "77a51741394d1b7c59b260113955bbca",
                "sha256": "8c6c48c69f5413674d9d4b199b1cc41508409e778d54ede18079afdc5d5aea55"
            },
            "downloads": -1,
            "filename": "casbin_pymongo_adapter-0.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "77a51741394d1b7c59b260113955bbca",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 6951,
            "upload_time": "2021-06-06T09:01:38",
            "upload_time_iso_8601": "2021-06-06T09:01:38.708848Z",
            "url": "https://files.pythonhosted.org/packages/f1/9a/b02ec31d6e5ab94222b965bf224e5c98cd118ad53b8b9ff3ef2035ce25f9/casbin_pymongo_adapter-0.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2021-06-06 09:01:38",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": null,
    "github_project": "pycasbin",
    "error": "Could not fetch GitHub repository",
    "lcname": "casbin-pymongo-adapter"
}
        
Elapsed time: 0.24549s