Class: Inspec::Resources::SecurityPolicy

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

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ SecurityPolicy

Returns a new instance of SecurityPolicy.



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

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



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

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



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

def content
  read_content
end

#params(*opts) ⇒ Object



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

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

#resource_idObject



115
116
117
# File 'lib/inspec/resources/security_policy.rb', line 115

def resource_id
  "Security Policy"
end

#to_sObject



111
112
113
# File 'lib/inspec/resources/security_policy.rb', line 111

def to_s
  "Security Policy"
end