-
Notifications
You must be signed in to change notification settings - Fork 0
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
Graphql auth #751
Graphql auth #751
Conversation
…ty of schema fields (mutations)
app/graphql/mutation_type.rb
Outdated
# admin | ||
field :gameUpdateScore, field: GameUpdateScoreMutation.field do | ||
visibility -> (ctx) { Auth.visible(ctx) } | ||
end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to not have to re-define this for each mutation that requires auth. I have 2 ideas neither of which I fully understand how to implement:
- Push this down to the mutation itself and use something like
GraphQL::Relay::Mutation.accepts_definitions ( auth_required: ... )
- Somehow have an
auth_require do
block around all the mutations in this file
I'm debating what value the schema filter adds. Its cool to not even expose parts of the schema the user is not authorised for but it comes with a few issues:
|
part of #750
I can test locally that logging in shows additional schema fields and incognito shows less.
Notes - MutationOperation is useless because of differences in how context variables (user and tournament) are used in existing operations. I am going to remove MutationOperation and call operations manually in
resolve
.I added basic smoke screen tests here to capture api auth in tests. Testing all the logic via graphql can wait until I remove the operations.