Class: Inspec::Resources::WindowsFilePermissions
Instance Attribute Summary
#inspec
Instance Method Summary
collapse
#initialize
Instance Method Details
#check_file_permission_by_mask(_file, _access_type, _usergroup, _specific_user) ⇒ Object
248
249
250
|
# File 'lib/inspec/resources/file.rb', line 248
def check_file_permission_by_mask(_file, _access_type, _usergroup, _specific_user)
raise "`check_file_permission_by_mask` is not supported on Windows"
end
|
#check_file_permission_by_user(access_type, user, path) ⇒ Object
256
257
258
259
260
261
262
|
# File 'lib/inspec/resources/file.rb', line 256
def check_file_permission_by_user(access_type, user, path)
access_rule = translate_perm_names(access_type)
access_rule = convert_to_powershell_array(access_rule)
cmd = inspec.command("@(@((Get-Acl '#{path}').access | Where-Object {$_.AccessControlType -eq 'Allow' -and $_.IdentityReference -eq '#{user}' }) | Where-Object {($_.FileSystemRights.ToString().Split(',') | % {$_.trim()} | ? {#{access_rule} -contains $_}) -ne $null}) | measure | % { $_.Count }")
cmd.stdout.chomp == "0" ? false : true
end
|
#more_permissive_than? ⇒ Boolean
252
253
254
|
# File 'lib/inspec/resources/file.rb', line 252
def more_permissive_than?(*)
raise Inspec::Exceptions::ResourceSkipped, "The `more_permissive_than?` matcher is not supported on your OS yet."
end
|