Metadata-Version: 2.4
Name: scopie
Version: 0.2.1
Summary: Authorization engine providing fine grained access while you control the data. Aimed at being easy to use and implement without overtaking other parts of your system.
Author-email: Ronnie Smith <miniscruff@hey.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/miniscruff/scopie-py
Project-URL: Documentation, https://github.com/miniscruff/scopie-py
Project-URL: Repository, https://github.com/miniscruff/scopie-py.git
Project-URL: Issues, https://github.com/miniscruff/scopie-py/issues
Project-URL: Changelog, https://github.com/miniscruff/scopie-py/blob/main/CHANGELOG.md
Keywords: authorization
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# Scopie-py

[![PyPI - Version](https://img.shields.io/pypi/v/scopie?style=for-the-badge)](https://pypi.org/project/scopie/)
[![Static Badge](https://img.shields.io/badge/Stable-black?style=for-the-badge&logo=readthedocs&label=Docs)](https://scopie-py.readthedocs.io/en/stable/)

Python implementation of [scopie](https://github.com/miniscruff/scopie).

```python
from scopie import is_allowed

users = {
    "elsa": {
        "rules": ["allow/blog/create|update"],
    },
    "bella": {
        "rules": ["allow/blog/create"],
    },
}

blogPosts = {}

def create_blog(username, blogSlug, blogContent):
    user = users[username]
    if is_allowed(["blog/create"], user["rules"]):
        blogPosts[blogSlug] = {
            "author": user,
            "content": blogContent,
        }

def update_blog(username, blogSlug, blogContent):
    user = users[username]
    if is_allowed(["blog/update"], user["rules"]):
        blogPosts[blogSlug] = {
            "author": user,
            "content": blogContent,
        }
```
