Class: Chef::ReservedNames::Win32::Security::SecurityDescriptor

Inherits:
Object
  • Object
show all
Defined in:
lib/chef/win32/security/security_descriptor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(pointer) ⇒ SecurityDescriptor

Returns a new instance of SecurityDescriptor.



28
29
30
# File 'lib/chef/win32/security/security_descriptor.rb', line 28

def initialize(pointer)
  @pointer = pointer
end

Instance Attribute Details

#pointerObject (readonly)

Returns the value of attribute pointer.



32
33
34
# File 'lib/chef/win32/security/security_descriptor.rb', line 32

def pointer
  @pointer
end

Instance Method Details

#absolute?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/chef/win32/security/security_descriptor.rb', line 34

def absolute?
  !self_relative?
end

#controlObject



38
39
40
41
# File 'lib/chef/win32/security/security_descriptor.rb', line 38

def control
  control, version = Chef::ReservedNames::Win32::Security.get_security_descriptor_control(self)
  control
end

#daclObject



43
44
45
46
47
48
# File 'lib/chef/win32/security/security_descriptor.rb', line 43

def dacl
  raise "DACL not present" unless dacl_present?

  present, acl, defaulted = Chef::ReservedNames::Win32::Security.get_security_descriptor_dacl(self)
  acl
end

#dacl_inherits?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/chef/win32/security/security_descriptor.rb', line 50

def dacl_inherits?
  (control & Chef::ReservedNames::Win32::API::Security::SE_DACL_PROTECTED) == 0
end

#dacl_present?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/chef/win32/security/security_descriptor.rb', line 54

def dacl_present?
  (control & Chef::ReservedNames::Win32::API::Security::SE_DACL_PRESENT) != 0
end

#groupObject



58
59
60
61
# File 'lib/chef/win32/security/security_descriptor.rb', line 58

def group
  result, defaulted = Chef::ReservedNames::Win32::Security.get_security_descriptor_group(self)
  result
end

#ownerObject



63
64
65
66
# File 'lib/chef/win32/security/security_descriptor.rb', line 63

def owner
  result, defaulted = Chef::ReservedNames::Win32::Security.get_security_descriptor_owner(self)
  result
end

#saclObject



68
69
70
71
72
73
74
75
# File 'lib/chef/win32/security/security_descriptor.rb', line 68

def sacl
  raise "SACL not present" unless sacl_present?

  Security.with_privileges("SeSecurityPrivilege") do
    present, acl, defaulted = Chef::ReservedNames::Win32::Security.get_security_descriptor_sacl(self)
    acl
  end
end

#sacl_inherits?Boolean

Returns:

  • (Boolean)


77
78
79
# File 'lib/chef/win32/security/security_descriptor.rb', line 77

def sacl_inherits?
  (control & Chef::ReservedNames::Win32::API::Security::SE_SACL_PROTECTED) == 0
end

#sacl_present?Boolean

Returns:

  • (Boolean)


81
82
83
# File 'lib/chef/win32/security/security_descriptor.rb', line 81

def sacl_present?
  (control & Chef::ReservedNames::Win32::API::Security::SE_SACL_PRESENT) != 0
end

#self_relative?Boolean

Returns:

  • (Boolean)


85
86
87
# File 'lib/chef/win32/security/security_descriptor.rb', line 85

def self_relative?
  (control & Chef::ReservedNames::Win32::API::Security::SE_SELF_RELATIVE) != 0
end

#valid?Boolean

Returns:

  • (Boolean)


89
90
91
# File 'lib/chef/win32/security/security_descriptor.rb', line 89

def valid?
  Chef::ReservedNames::Win32::Security.is_valid_security_descriptor(self)
end