Is there a way to do this like what django-guardian does or DRF with his DjangoModelPermissions?
It has been discussed previously
https://github.com/graphql-python/graphene-django/issues/79
I have done following as my way to handle permissions currently
https://medium.com/@anish.shrestha/relay-graphene-django-and-permissions-b1b2b96daf20
@annshress how about queries? This only addresses mutation
@hz-equityzen I have not felt the need to handle permissions in queries.
Edit: Okay considering many people need query related permission. You will need to write your own resolver for that.
For example.
def resolve_object(root, info, **kwargs):
if info.context.user.is_authenticated():
do something
else:
do something else
Actually, In the project I'm working on I need to handle permissions in queries
You can check this out https://github.com/taoufik07/django-graphene-permissions
I'd refer to the previous body of discussion here. Additionally, should you use django-graphql-jwt, it comes with a built in permissions handler done using decorators.
check this out https://github.com/0soft/graphene-django-plus
This is exactly what I was looking for, thanks a lot!
Most helpful comment
I'd refer to the previous body of discussion here. Additionally, should you use django-graphql-jwt, it comes with a built in permissions handler done using decorators.