class Chef::ReservedNames::Win32::Security::ACL
Attributes
Public Class Methods
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
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
Source
# File lib/chef/win32/security/acl.rb, line 95 def self.align_dword(size) (size + 4 - 1) & 0xfffffffc end
Public Instance Methods
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 true end
Source
# File lib/chef/win32/security/acl.rb, line 59 def [](index) Chef::ReservedNames::Win32::Security.get_ace(self, index) end
Source
# File lib/chef/win32/security/acl.rb, line 63 def delete_at(index) Chef::ReservedNames::Win32::Security.delete_ace(self, index) end
Source
# File lib/chef/win32/security/acl.rb, line 67 def each 0.upto(length - 1) { |i| yield self[i] } end
Source
# File lib/chef/win32/security/acl.rb, line 71 def insert(index, *aces) aces.reverse_each { |ace| add_ace(self, ace, index) } end
Source
# File lib/chef/win32/security/acl.rb, line 79 def push(*aces) aces.each { |ace| Chef::ReservedNames::Win32::Security.add_ace(self, ace) } end
Source
# File lib/chef/win32/security/acl.rb, line 91 def to_s "[#{collect(&:to_s).join(", ")}]" end
Source
# File lib/chef/win32/security/acl.rb, line 83 def unshift(*aces) aces.each { |ace| Chef::ReservedNames::Win32::Security.add_ace(self, ace, 0) } end
Source
# File lib/chef/win32/security/acl.rb, line 87 def valid? Chef::ReservedNames::Win32::Security.is_valid_acl(self) end