casbin-pymongo-adapter


Namecasbin-pymongo-adapter JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/officialpycasbin/pymongo-adapter
SummaryPyMongo Adapter for PyCasbin
upload_time2024-11-11 17:33:10
maintainerNone
docs_urlNone
authorCasbin
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/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 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/officialpycasbin/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": "Casbin",
    "author_email": "admin@casbin.org",
    "download_url": "https://files.pythonhosted.org/packages/43/ff/09138595b3e68d2bb216f456f4b82cff34f43d1af04aea6a2ab6eab31bac/casbin_pymongo_adapter-1.2.0.tar.gz",
    "platform": null,
    "description": "PyMongo Adapter for PyCasbin\n====\n\n[![Build Status](https://www.travis-ci.org/officialpycasbin/pymongo-adapter.svg?branch=master)](https://www.travis-ci.org/officialpycasbin/pymongo-adapter)\n[![Coverage Status](https://coveralls.io/repos/github/officialpycasbin/pymongo-adapter/badge.svg)](https://coveralls.io/github/officialpycasbin/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.2.0",
    "project_urls": {
        "Homepage": "https://github.com/officialpycasbin/pymongo-adapter"
    },
    "split_keywords": [
        "casbin",
        " pymongo",
        " casbin-adapter",
        " rbac",
        " access control",
        " abac",
        " acl",
        " permission"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a4b297d744e2a381a8c3d0f43c71b163c9a56964e546c9e6e51a805153d2930b",
                "md5": "feb8d5a6e056e16dde7619aff76fa581",
                "sha256": "38955cb928d93d6b9f83a5d05c8e1238cb20c36ea460183c373efe805fc8e995"
            },
            "downloads": -1,
            "filename": "casbin_pymongo_adapter-1.2.0-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "feb8d5a6e056e16dde7619aff76fa581",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": ">=3.6",
            "size": 9220,
            "upload_time": "2024-11-11T17:33:09",
            "upload_time_iso_8601": "2024-11-11T17:33:09.844002Z",
            "url": "https://files.pythonhosted.org/packages/a4/b2/97d744e2a381a8c3d0f43c71b163c9a56964e546c9e6e51a805153d2930b/casbin_pymongo_adapter-1.2.0-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "43ff09138595b3e68d2bb216f456f4b82cff34f43d1af04aea6a2ab6eab31bac",
                "md5": "0146f8374686b2bcfdb0ae5b658f16b3",
                "sha256": "376256de1e210ab4ef97bfa00c7af255ef54648ea78eff5da5e5627bdc96b47d"
            },
            "downloads": -1,
            "filename": "casbin_pymongo_adapter-1.2.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0146f8374686b2bcfdb0ae5b658f16b3",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 9200,
            "upload_time": "2024-11-11T17:33:10",
            "upload_time_iso_8601": "2024-11-11T17:33:10.706616Z",
            "url": "https://files.pythonhosted.org/packages/43/ff/09138595b3e68d2bb216f456f4b82cff34f43d1af04aea6a2ab6eab31bac/casbin_pymongo_adapter-1.2.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-11 17:33:10",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "officialpycasbin",
    "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.38484s