{"id":22959848,"url":"https://github.com/pycasbin/pymongo-adapter","last_synced_at":"2025-08-13T05:32:41.850Z","repository":{"id":48389754,"uuid":"271982598","full_name":"pycasbin/pymongo-adapter","owner":"pycasbin","description":"PyMongo Adapter for PyCasbin","archived":false,"fork":false,"pushed_at":"2024-10-26T05:23:52.000Z","size":30,"stargazers_count":10,"open_issues_count":0,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-12-13T21:43:41.925Z","etag":null,"topics":["abac","access-control","acl","casbin","permissions","rbac","security"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pycasbin.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-06-13T09:56:37.000Z","updated_at":"2024-10-26T05:23:56.000Z","dependencies_parsed_at":"2024-11-27T08:17:19.583Z","dependency_job_id":null,"html_url":"https://github.com/pycasbin/pymongo-adapter","commit_stats":{"total_commits":18,"total_committers":6,"mean_commits":3.0,"dds":0.6111111111111112,"last_synced_commit":"a37de233981b8da6a7657cc6f26025bbd5b72636"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pycasbin%2Fpymongo-adapter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pycasbin%2Fpymongo-adapter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pycasbin%2Fpymongo-adapter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pycasbin%2Fpymongo-adapter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pycasbin","download_url":"https://codeload.github.com/pycasbin/pymongo-adapter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229740049,"owners_count":18116882,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["abac","access-control","acl","casbin","permissions","rbac","security"],"created_at":"2024-12-14T18:29:00.539Z","updated_at":"2024-12-14T18:29:01.315Z","avatar_url":"https://github.com/pycasbin.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"PyMongo Adapter for PyCasbin\r\n====\r\n\r\n[![Build Status](https://www.travis-ci.org/pycasbin/pymongo-adapter.svg?branch=master)](https://www.travis-ci.org/pycasbin/pymongo-adapter)\r\n[![Coverage Status](https://coveralls.io/repos/github/pycasbin/pymongo-adapter/badge.svg)](https://coveralls.io/github/pycasbin/pymongo-adapter)\r\n[![Version](https://img.shields.io/pypi/v/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)\r\n[![PyPI - Wheel](https://img.shields.io/pypi/wheel/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)\r\n[![Pyversions](https://img.shields.io/pypi/pyversions/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)\r\n[![Download](https://img.shields.io/pypi/dm/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)\r\n[![License](https://img.shields.io/pypi/l/casbin_pymongo_adapter.svg)](https://pypi.org/project/casbin_pymongo_adapter/)\r\n\r\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.\r\n\r\n## Installation\r\n\r\n```\r\npip install casbin_pymongo_adapter\r\n```\r\n\r\n## Simple Example\r\n\r\n```python\r\nimport casbin_pymongo_adapter\r\nimport casbin\r\n\r\nadapter = casbin_pymongo_adapter.Adapter('mongodb://localhost:27017/', \"dbname\")\r\n\r\ne = casbin.Enforcer('path/to/model.conf', adapter, True)\r\n\r\nsub = \"alice\"  # the user that wants to access a resource.\r\nobj = \"data1\"  # the resource that is going to be accessed.\r\nact = \"read\"  # the operation that the user performs on the resource.\r\n\r\nif e.enforce(sub, obj, act):\r\n    # permit alice to read data1casbin_sqlalchemy_adapter\r\n    pass\r\nelse:\r\n    # deny the request, show an error\r\n    pass\r\n```\r\n\r\n\r\n### Getting Help\r\n\r\n- [PyCasbin](https://github.com/casbin/pycasbin)\r\n\r\n### License\r\n\r\nThis project is licensed under the [Apache 2.0 license](LICENSE).\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpycasbin%2Fpymongo-adapter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpycasbin%2Fpymongo-adapter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpycasbin%2Fpymongo-adapter/lists"}