Skip to content

Conversation

@santiagoarce
Copy link

Description

Please describe your pull request and any relevant information.

Checklist

  • I have added appropriate tests if this PR fixes a bug or adds a feature.
  • All status checks (tests, linting, etc...) are passing.

@kylejginavan
Copy link
Member

Task linked: PD-20757 Add Sharing section

@santiagoarce santiagoarce changed the title [PD-20757] - add after_assign_attributes methods for grapqhl resources [PD-20757] - add after_assign_attributes and authorized? methods for grapqhl resources Sep 10, 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

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)

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?


def self.authorized?(action, object, context)
!config.authorize || config.authorize.call(action, object, context)
def self.authorized?(action, object, context, args)

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants