Class: Inspec::Resources::SecurityPolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/resources/security_policy.rb

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ SecurityPolicy

Returns a new instance of SecurityPolicy.



82
83
84
# File 'lib/resources/security_policy.rb', line 82

def initialize(opts = {})
  @translate_sid = opts[:translate_sid] || false
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name) ⇒ Object



96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/resources/security_policy.rb', line 96

def method_missing(name)
  params = read_params
  return nil if params.nil?

  # deep search for hash key
  params.extend Hashie::Extensions::DeepFind
  res = params.deep_find(name.to_s)

  # return an empty array if configuration does not include rights configuration
  return [] if res.nil? && MS_PRIVILEGES_RIGHTS.include?(name.to_s)
  res
end

Instance Method Details

#contentObject



86
87
88
# File 'lib/resources/security_policy.rb', line 86

def content
  read_content
end

#params(*opts) ⇒ Object



90
91
92
93
94
# File 'lib/resources/security_policy.rb', line 90

def params(*opts)
  opts.inject(read_params) do |res, nxt|
    res.respond_to?(:key) ? res[nxt] : nil
  end
end

#to_sObject



109
110
111
# File 'lib/resources/security_policy.rb', line 109

def to_s
  'Security Policy'
end