An open API service indexing awesome lists of open source software.

https://github.com/miniscruff/scopie-py

Python implementation of scopie
https://github.com/miniscruff/scopie-py

Last synced: 5 months ago
JSON representation

Python implementation of scopie

Awesome Lists containing this project

README

          

# 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": {
"permissions": ["allow:blog/create|update"],
},
"bella": {
"permissions": ["allow:blog/create"],
},
}

blogPosts = {}

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

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