class Chef::ReservedNames::Win32::Security::ACL
Attributes
struct[R]
Public Class Methods
create(aces)
click to toggle source
# File lib/chef/win32/security/acl.rb, line 36 def self.create(aces) aces_size = aces.inject(0) { |sum,ace| sum + ace.size } acl_size = align_dword(Chef::ReservedNames::Win32::API::Security::ACLStruct.size + aces_size) # What the heck is 94??? acl = Chef::ReservedNames::Win32::Security.initialize_acl(acl_size) aces.each { |ace| Chef::ReservedNames::Win32::Security.add_ace(acl, ace) } acl end
new(pointer, owner = nil)
click to toggle source
# File lib/chef/win32/security/acl.rb, line 29 def initialize(pointer, owner = nil) @struct = Chef::ReservedNames::Win32::API::Security::ACLStruct.new pointer # Keep a reference to the actual owner of this memory so that it isn't freed out from under us # TODO this could be avoided if we could mark a pointer's parent manually @owner = owner end
Private Class Methods
align_dword(size)
click to toggle source
# File lib/chef/win32/security/acl.rb, line 95 def self.align_dword(size) (size + 4 - 1) & 0xfffffffc end
Public Instance Methods
==(other)
click to toggle source
# File lib/chef/win32/security/acl.rb, line 46 def ==(other) return false if length != other.length 0.upto(length-1) do |i| return false if self[i] != other[i] end return true end
[](index)
click to toggle source
# File lib/chef/win32/security/acl.rb, line 58 def [](index) Chef::ReservedNames::Win32::Security.get_ace(self, index) end
delete_at(index)
click to toggle source
# File lib/chef/win32/security/acl.rb, line 62 def delete_at(index) Chef::ReservedNames::Win32::Security.delete_ace(self, index) end
each() { |self| ... }
click to toggle source
# File lib/chef/win32/security/acl.rb, line 66 def each 0.upto(length-1) { |i| yield self[i] } end
insert(index, *aces)
click to toggle source
# File lib/chef/win32/security/acl.rb, line 70 def insert(index, *aces) aces.reverse_each { |ace| add_ace(self, ace, index) } end
length()
click to toggle source
# File lib/chef/win32/security/acl.rb, line 74 def length struct[:AceCount] end
pointer()
click to toggle source
# File lib/chef/win32/security/acl.rb, line 54 def pointer struct.pointer end
push(*aces)
click to toggle source
# File lib/chef/win32/security/acl.rb, line 78 def push(*aces) aces.each { |ace| Chef::ReservedNames::Win32::Security.add_ace(self, ace) } end
to_s()
click to toggle source
# File lib/chef/win32/security/acl.rb, line 90 def to_s "[#{self.collect { |ace| ace.to_s }.join(", ")}]" end
unshift(*aces)
click to toggle source
# File lib/chef/win32/security/acl.rb, line 82 def unshift(*aces) aces.each { |ace| Chef::ReservedNames::Win32::Security.add_ace(self, ace, 0) } end
valid?()
click to toggle source
# File lib/chef/win32/security/acl.rb, line 86 def valid? Chef::ReservedNames::Win32::Security.is_valid_acl(self) end