This commit is contained in:
parent
9aacb75e84
commit
94bf54b192
|
@ -40,9 +40,10 @@ async def get_my_shout(_, info, shout_id: int):
|
||||||
if not author_id:
|
if not author_id:
|
||||||
return {"error": "no author found", "shout": None}
|
return {"error": "no author found", "shout": None}
|
||||||
roles = info.context.get("roles", [])
|
roles = info.context.get("roles", [])
|
||||||
if "editor" not in roles and not filter(
|
is_editor = "editor" in roles
|
||||||
lambda x: x.id == int(author_id), [x for x in shout.authors]
|
is_author = filter(lambda x: x.id == int(author_id), [x for x in shout.authors])
|
||||||
):
|
can_edit = is_editor or is_author
|
||||||
|
if not can_edit:
|
||||||
return {"error": "forbidden", "shout": None}
|
return {"error": "forbidden", "shout": None}
|
||||||
return {"error": None, "shout": shout}
|
return {"error": None, "shout": shout}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user