-
Notifications
You must be signed in to change notification settings - Fork 769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistency in the way ForeignKeys resolutions are treated #1111
Labels
Comments
tcleonard
pushed a commit
to tcleonard/graphene-django
that referenced
this issue
Feb 10, 2021
tcleonard
pushed a commit
to tcleonard/graphene-django
that referenced
this issue
Feb 10, 2021
tcleonard
pushed a commit
to tcleonard/graphene-django
that referenced
this issue
Feb 10, 2021
tcleonard
pushed a commit
to loft-orbital/graphene-django
that referenced
this issue
Feb 10, 2021
Submitted 2 PRs:
|
tcleonard
added a commit
to loft-orbital/graphene-django
that referenced
this issue
Feb 10, 2021
…ix_foreign_key_field_v2 Issue graphql-python#1111: make ForeignKeys resolve symmetrically (v2)
tcleonard
added a commit
to loft-orbital/graphene-django
that referenced
this issue
Feb 10, 2021
tcleonard
added a commit
to loft-orbital/graphene-django
that referenced
this issue
Feb 10, 2021
…ix_foreign_key_field_v2 Issue graphql-python#1111: make ForeignKeys resolve symmetrically (v2)
tcleonard
pushed a commit
to loft-orbital/graphene-django
that referenced
this issue
Mar 10, 2021
hello, I am facing the same issue, how is this work going? |
This is blocking on me, I need to review the alternative PR to see if it's a better solution to the problem. Haven't had time to take a look just yet. For the record I have been using my PR for quite some time and other than the performance overhead it does the job. |
tcleonard
pushed a commit
to loft-orbital/graphene-django
that referenced
this issue
Jan 4, 2022
tcleonard
pushed a commit
to loft-orbital/graphene-django
that referenced
this issue
Mar 20, 2022
tcleonard
added a commit
to loft-orbital/graphene-django
that referenced
this issue
Mar 20, 2022
…fix_foreign_key_field Issue graphql-python#1111: foreign key should also call get_queryset method
tcleonard
pushed a commit
to loft-orbital/graphene-django
that referenced
this issue
Sep 19, 2022
tcleonard
pushed a commit
to loft-orbital/graphene-django
that referenced
this issue
Sep 19, 2022
tcleonard
pushed a commit
to loft-orbital/graphene-django
that referenced
this issue
Sep 19, 2022
firaskafri
pushed a commit
that referenced
this issue
Sep 23, 2022
* Issue #1111: foreign key should also call get_queryset method * fix: test for graphene PR graphql-python/graphene#1412 Co-authored-by: Thomas Leonard <thomas@loftorbital.com>
tcleonard
pushed a commit
to loft-orbital/graphene-django
that referenced
this issue
Sep 26, 2022
superlevure
pushed a commit
to loft-orbital/graphene-django
that referenced
this issue
Aug 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In the converters the way the reverse relation of a foreign key is dealt with differently from the forward relationship.
Indeed you can see in the
ManyToOneRel
conversionconvert_field_to_list_or_connection()
we convert the field to either aDjangoConnectionField
or aDjangoListField
(depending on if it uses relay or not).Both of those make sure that the resolution of the field is going through those custom classes resolvers.
This is important as those implement some hooks to resolve the queryset in a custom way (or to give a custom queryset manager).
On the other hand, the
ForeignKey
conversionconvert_field_to_djangomodel()
implements a simplegraphene.Field
hence bypassing any potential custom queryset filtering.This is notably a problem as those resolver hooks are typically used to implement authorization... and this behavior means that we enforce it only in one direction, resulting in permissions leaks.
I have a quick fix for this problem but I think it degrades performances by doing an additional query to the database:
I am going to submit as a PR with some unit tests but I would love to get some feedback as it seems pretty hacky...
The text was updated successfully, but these errors were encountered: