401-ex
This commit is contained in:
parent
8a449bbe7a
commit
1099f8a185
|
@ -75,7 +75,9 @@ async def get_shout(_, info, slug=None, shout_id=None):
|
||||||
|
|
||||||
author = session.query(Author).filter(Author.user == user_id).first()
|
author = session.query(Author).filter(Author.user == user_id).first()
|
||||||
if not isinstance(author, Author):
|
if not isinstance(author, Author):
|
||||||
return {'error': 'access denied'}
|
raise HTTPException(
|
||||||
|
status_code=401, detail='shout is not published yet'
|
||||||
|
)
|
||||||
|
|
||||||
author_id = author.id if author else None
|
author_id = author.id if author else None
|
||||||
if (
|
if (
|
||||||
|
@ -84,7 +86,9 @@ async def get_shout(_, info, slug=None, shout_id=None):
|
||||||
and not any(x == author_id for x in [a.id for a in shout.authors])
|
and not any(x == author_id for x in [a.id for a in shout.authors])
|
||||||
and 'editor' not in roles
|
and 'editor' not in roles
|
||||||
):
|
):
|
||||||
return {'error': 'access denied'}
|
raise HTTPException(
|
||||||
|
status_code=401, detail='shout is not published yet'
|
||||||
|
)
|
||||||
|
|
||||||
shout.stat = {
|
shout.stat = {
|
||||||
'viewed': await ViewedStorage.get_shout(shout.slug),
|
'viewed': await ViewedStorage.get_shout(shout.slug),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user