-
Notifications
You must be signed in to change notification settings - Fork 766
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.
All reactions
check this out https://github.com/0soft/graphene-django-plus
Replies: 8 comments
-
It has been discussed previously
#79
I have done following as my way to handle permissions currently
https://medium.com/@anish.shrestha/relay-graphene-django-and-permissions-b1b2b96daf20
Beta Was this translation helpful? Give feedback.
All reactions
-
@annshress how about queries? This only addresses mutation
Beta Was this translation helpful? Give feedback.
All reactions
-
@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.
All reactions
-
👎 14
-
Actually, In the project I'm working on I need to handle permissions in queries
Beta Was this translation helpful? Give feedback.
All reactions
-
You can check this out https://github.com/taoufik07/django-graphene-permissions
Beta Was this translation helpful? Give feedback.
All reactions
-
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.
All reactions
-
👍 2
-
check this out https://github.com/0soft/graphene-django-plus
Beta Was this translation helpful? Give feedback.
All reactions
-
🎉 1
-
This is exactly what I was looking for, thanks a lot!
Beta Was this translation helpful? Give feedback.