-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Relay Connection authorization integration #1752
Comments
I wasn't really sure how to make it work. For example, let's say you have a connection which wraps a AR::Relation of A related feature was added for something like this: #1723 |
We've always delegated to node type with implementations like this: # Edge
def authorized?(edge, ctx)
node_type.authorized?(edge.node, ctx)
end
# Connection
def authorized?(connection, ctx)
edge_authorizations = connection.edges.map { |edge| edge_type.authorized?(edge, ctx) }
Promise.all(edge_authorizations).then(&:all?)
end |
This is kinda done here: graphql-ruby/lib/graphql/types/relay/base_connection.rb Lines 79 to 89 in 90474a9
graphql-ruby/lib/graphql/types/relay/base_edge.rb Lines 41 to 51 in 90474a9
It might be improved by ahead-of-time filtering of nodes, as shown above, but right now that filtering is delayed until the node itself is queried. |
Visibility and accessibility both have integration with Relay connections here:
graphql-ruby/lib/graphql/schema.rb
Lines 971 to 973 in be5439d
However this doesn't apply to authorization since
authorized?
is called from field instrumentation and not viacall_on_type_class
on the schema.Is this something that should be taken care of automatically? I'd also assume
relay_node_type
should be the source ofauthorized?
for the connection and edge.The text was updated successfully, but these errors were encountered: