How to handle permissions per Object #1182
-
Is there a way to do this like what django-guardian does or DRF with his DjangoModelPermissions? |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments
-
It has been discussed previously I have done following as my way to handle permissions currently |
Beta Was this translation helpful? Give feedback.
-
@annshress how about queries? This only addresses mutation |
Beta Was this translation helpful? Give feedback.
-
@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 |
Beta Was this translation helpful? Give feedback.
-
Actually, In the project I'm working on I need to handle permissions in queries |
Beta Was this translation helpful? Give feedback.
-
You can check this out https://github.com/taoufik07/django-graphene-permissions |
Beta Was this translation helpful? Give feedback.
-
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. |
Beta Was this translation helpful? Give feedback.
-
check this out https://github.com/0soft/graphene-django-plus |
Beta Was this translation helpful? Give feedback.
-
This is exactly what I was looking for, thanks a lot! |
Beta Was this translation helpful? Give feedback.
check this out https://github.com/0soft/graphene-django-plus