add route for admins to list all groups

This commit is contained in:
ducklet 2021-07-11 17:24:52 +02:00
parent 88fa1355cd
commit cc0ba96a9e

View file

@ -234,6 +234,13 @@ async def load_imdb_user_ratings(request):
return JSONResponse({"new_ratings": [asplain(r) for r in ratings]}) return JSONResponse({"new_ratings": [asplain(r) for r in ratings]})
@route("/groups")
@requires(["authenticated", "admin"])
async def list_groups(request):
groups = await db.get_all(Group)
return JSONResponse([asplain(g) for g in groups])
@route("/groups", methods=["POST"]) @route("/groups", methods=["POST"])
@requires(["authenticated", "admin"]) @requires(["authenticated", "admin"])
async def add_group(request): async def add_group(request):