[PD-20757] - add after_assign_attributes and authorized? methods for grapqhl resources#65
Open
santiagoarce wants to merge 4 commits intoOneHQ:masterfrom
Open
[PD-20757] - add after_assign_attributes and authorized? methods for grapqhl resources#65santiagoarce wants to merge 4 commits intoOneHQ:masterfrom
santiagoarce wants to merge 4 commits intoOneHQ:masterfrom
Conversation
Member
|
Task linked: PD-20757 Add Sharing section |
joseloTala
reviewed
Sep 16, 2025
| 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 |
joseloTala
reviewed
Sep 16, 2025
| 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.
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?
joseloTala
reviewed
Sep 16, 2025
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.
maybe the method signature is **args just so we dont make it mandatory
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Please describe your pull request and any relevant information.
Checklist