Commit 3583ddf5 authored by Luna's avatar Luna 😻

add api.admin

parent f848165e
"""
elixire - admin routes
"""
from sanic import Blueprint, response
from ..common_auth import login_user, check_admin
bp = Blueprint('admin')
@bp.get('/api/admin/test')
async def test_admin(request):
"""Get a json payload for admin users.
This is just a test route.
"""
user = await login_user(request)
await check_admin(user['id'], True)
return response.json({
'admin': True
})
......@@ -14,6 +14,7 @@ import api.bp.upload
import api.bp.files
import api.bp.shorten
import api.bp.fetch
import api.bp.admin
from api.errors import APIError
......@@ -32,6 +33,7 @@ app.blueprint(api.bp.upload.bp)
app.blueprint(api.bp.files.bp)
app.blueprint(api.bp.shorten.bp)
app.blueprint(api.bp.fetch.bp)
app.blueprint(api.bp.admin.bp)
logging.basicConfig(level=logging.INFO)
log = logging.getLogger(__name__)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment