casbin-pymongo-adapter


Namecasbin-pymongo-adapter JSON
Version 1.1.0 PyPI version JSON
download
home_pagehttps://github.com/pycasbin/pymongo-adapter
SummaryPyMongo Adapter for PyCasbin
upload_time2024-03-29 10:02:28
maintainerNone
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 casbin pymongo
Travis-CI No Travis.
coveralls test coverage
            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": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "casbin, pymongo, casbin-adapter, rbac, access control, abac, acl, permission",
    "author": "TechLee,Xhy-5000,AmosChenYQ",
    "author_email": "techlee@qq.com,amoschenyq@foxmail.com",
    "download_url": "https://files.pythonhosted.org/packages/6c/8d/d816e8a3042511b70bf116e225b7bd15a3379c8b6717ad8468e64646e600/casbin_pymongo_adapter-1.1.0.tar.gz",
    "platform": null,
    "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",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "PyMongo Adapter for PyCasbin",
    "version": "1.1.0",
    "project_urls": {
        "Homepage": "https://github.com/pycasbin/pymongo-adapter"
    },
    "split_keywords": [
        "casbin",
        " pymongo",
        " casbin-adapter",
        " rbac",
        " access control",
        " abac",
        " acl",
        " permission"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "138c2adc0bef41067a6e69adae569b748830d04db3033c4d542ff88e3835e495",
                "md5": "c1eab2fd66baea92f8e746653062d4ad",
                "sha256": "864c84265332facb46d41987fb441aebdb884730ec9158642e0976901116549f"
            },
            "downloads": -1,
            "filename": "casbin_pymongo_adapter-1.1.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "c1eab2fd66baea92f8e746653062d4ad",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 9225,
            "upload_time": "2024-03-29T10:02:26",
            "upload_time_iso_8601": "2024-03-29T10:02:26.980166Z",
            "url": "https://files.pythonhosted.org/packages/13/8c/2adc0bef41067a6e69adae569b748830d04db3033c4d542ff88e3835e495/casbin_pymongo_adapter-1.1.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "6c8dd816e8a3042511b70bf116e225b7bd15a3379c8b6717ad8468e64646e600",
                "md5": "4c50e4dff9d82ee1b7dd87cac9428d47",
                "sha256": "03ea6f7b1cdf7d82b0de7c942f976fdaa867e08037ab931b009b53bcaa9ee2cd"
            },
            "downloads": -1,
            "filename": "casbin_pymongo_adapter-1.1.0.tar.gz",
            "has_sig": false,
            "md5_digest": "4c50e4dff9d82ee1b7dd87cac9428d47",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 9233,
            "upload_time": "2024-03-29T10:02:28",
            "upload_time_iso_8601": "2024-03-29T10:02:28.663474Z",
            "url": "https://files.pythonhosted.org/packages/6c/8d/d816e8a3042511b70bf116e225b7bd15a3379c8b6717ad8468e64646e600/casbin_pymongo_adapter-1.1.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-29 10:02:28",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pycasbin",
    "github_project": "pymongo-adapter",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [
        {
            "name": "casbin",
            "specs": [
                [
                    ">=",
                    "0.8.4"
                ]
            ]
        },
        {
            "name": "pymongo",
            "specs": [
                [
                    ">=",
                    "3.10.1"
                ]
            ]
        }
    ],
    "lcname": "casbin-pymongo-adapter"
}
        
Elapsed time: 0.23892s