Class: Gitlab::Graphql::Authorize::ConnectionFilterExtension::Redactor

Inherits:
Object
  • Object
show all
Includes:
Laziness
Defined in:
lib/gitlab/graphql/authorize/connection_filter_extension.rb

Instance Method Summary collapse

Methods included from Laziness

#defer, #force

Constructor Details

#initialize(type, context, resolver) ⇒ Redactor

Returns a new instance of Redactor.



10
11
12
13
14
# File 'lib/gitlab/graphql/authorize/connection_filter_extension.rb', line 10

def initialize(type, context, resolver)
  @type = type
  @context = context
  @resolver = resolver
end

Instance Method Details

#active?Boolean

Returns:

  • (Boolean)


23
24
25
26
27
28
29
30
# File 'lib/gitlab/graphql/authorize/connection_filter_extension.rb', line 23

def active?
  # some scalar types (such as integers) do not respond to :authorized?
  return false unless @type.respond_to?(:authorized?)

  auth = @type.try(:authorization)

  auth.nil? || auth.any?
end

#redact(nodes) ⇒ Object



16
17
18
19
20
21
# File 'lib/gitlab/graphql/authorize/connection_filter_extension.rb', line 16

def redact(nodes)
  perform_before_authorize_action(nodes)
  remove_unauthorized(nodes)

  nodes
end