mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-04-25 19:43:51 +03:00
Verify there is a viewer on context
This commit is contained in:
parent
063cced585
commit
ad2342a08b
|
@ -122,7 +122,10 @@ def auth_resolver(parent_resolver, permissions, raise_exception, root, info, **a
|
||||||
:return: Resolved field. None if the viewer does not have permission to access the field.
|
:return: Resolved field. None if the viewer does not have permission to access the field.
|
||||||
"""
|
"""
|
||||||
# Get viewer from context
|
# Get viewer from context
|
||||||
|
if not hasattr(info.context, 'user'):
|
||||||
|
raise PermissionDenied()
|
||||||
user = info.context.user
|
user = info.context.user
|
||||||
|
|
||||||
if has_permissions(user, permissions):
|
if has_permissions(user, permissions):
|
||||||
if parent_resolver:
|
if parent_resolver:
|
||||||
# A resolver is provided in the class
|
# A resolver is provided in the class
|
||||||
|
|
Loading…
Reference in New Issue
Block a user