-
Notifications
You must be signed in to change notification settings - Fork 26
[PD-20757] - add after_assign_attributes and authorized? methods for grapqhl resources #65
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
base: master
Are you sure you want to change the base?
Conversation
|
Task linked: PD-20757 Add Sharing section |
| def build_mutation(action:, require_primary_key: false, nil_klass: false, &block) | ||
| gql_name = "#{graphql_name}#{action.to_s.titleize}" | ||
| scoped_model_name = model_name | ||
| scoped_self = self |
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.
why do we need this?
| def authorized?(object, context) | ||
| super && ::HQ::GraphQL.authorized?(authorized_action, object, context) | ||
| def authorized?(object, context, args = nil) | ||
| super(object, context) && ::HQ::GraphQL.authorized?(authorized_action, object, context, args) |
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.
why are we passing object and context to super? did we changed this method? is it better to use **args? so we dont have to default it to nil?
lib/hq/graphql.rb
Outdated
|
|
||
| def self.authorized?(action, object, context) | ||
| !config.authorize || config.authorize.call(action, object, context) | ||
| def self.authorized?(action, object, context, args) |
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.
maybe the method signature is **args just so we dont make it mandatory
Description
Please describe your pull request and any relevant information.
Checklist