class GraphqlAuthorize::AuthAdapters::Pundit

Public Instance Methods

authorize() click to toggle source
# File lib/graphql_authorize/auth_adapters/pundit.rb, line 6
def authorize
  if policy&.respond_to?(pundit_action)
    policy.send(pundit_action)
  else
    false
  end
end

Private Instance Methods

action() click to toggle source
# File lib/graphql_authorize/auth_adapters/pundit.rb, line 24
def action
  field_definition.authorize.first
end
policy() click to toggle source
# File lib/graphql_authorize/auth_adapters/pundit.rb, line 16
def policy
  @policy ||= ::Pundit.policy(context[:current_user], subject)
end
pundit_action() click to toggle source
# File lib/graphql_authorize/auth_adapters/pundit.rb, line 20
def pundit_action
  "#{action}?"
end
subject() click to toggle source
# File lib/graphql_authorize/auth_adapters/pundit.rb, line 28
def subject
  field_definition.authorize.last
end