graphene-django-cud
graphene-django-cud copied to clipboard
Add auto_context_queryset_filter Meta field
Would be nice having a field to restrict the available queryset for update and patch mutations based on context values. For example, say you have the field organization
in the context. You could do something like this:
class PatchUserMutation(DjangoPatchMutation):
class Meta:
model = User
auto_context_queryset_filter = {
"organization": "organization"
}
A user would then only be able to patch users in the same organization as them.
After closer consideration, I am unsure whether or not this should actually be a part of the library. At some point, we'll end up putting our (this library's) hands in too much business logic.