Class: RailsIam::Authorization::SkipAuthorizationRule

Inherits:
Data
  • Object
show all
Defined in:
app/services/rails_iam/authorization/skip_authorization_rule.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#exceptObject (readonly)

Returns the value of attribute except

Returns:

  • (Object)

    the current value of except



5
6
7
# File 'app/services/rails_iam/authorization/skip_authorization_rule.rb', line 5

def except
  @except
end

#onlyObject (readonly)

Returns the value of attribute only

Returns:

  • (Object)

    the current value of only



5
6
7
# File 'app/services/rails_iam/authorization/skip_authorization_rule.rb', line 5

def only
  @only
end

Instance Method Details

#matches?(action) ⇒ Boolean

Returns:

  • (Boolean)


9
10
11
12
13
14
15
16
# File 'app/services/rails_iam/authorization/skip_authorization_rule.rb', line 9

def matches?(action)
  action = action.to_sym

  return Array(only).map(&:to_sym).include?(action) if only.present?
  return Array(except).map(&:to_sym).exclude?(action) if except.present?

  true
end