Module: Puppet::Util::Windows::ADSI::Shared
Instance Method Summary collapse
- #get_sids(adsi_child_collection) ⇒ Object
- #name_sid_hash(names) ⇒ Object
- #parse_name(name) ⇒ Object
- #uri(name, host = '.') ⇒ Object
Instance Method Details
#get_sids(adsi_child_collection) ⇒ Object
131 132 133 134 135 136 137 138 |
# File 'lib/puppet/util/windows/adsi.rb', line 131 def get_sids(adsi_child_collection) sids = [] adsi_child_collection.each do |m| sids << Puppet::Util::Windows::SID.octet_string_to_sid_object(m.objectSID) end sids end |
#name_sid_hash(names) ⇒ Object
140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/puppet/util/windows/adsi.rb', line 140 def name_sid_hash(names) return {} if names.nil? || names.empty? sids = names.map do |name| sid = Puppet::Util::Windows::SID.name_to_sid_object(name) raise Puppet::Error.new( "Could not resolve name: #{name}" ) if !sid [sid.sid, sid] end Hash[ sids ] end |
#parse_name(name) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/puppet/util/windows/adsi.rb', line 119 def parse_name(name) if name =~ /\// raise Puppet::Error.new( "Value must be in DOMAIN\\user style syntax" ) end matches = name.scan(/((.*)\\)?(.*)/) domain = matches[0][1] || '.' account = matches[0][2] return account, domain end |
#uri(name, host = '.') ⇒ Object
110 111 112 113 114 115 116 117 |
# File 'lib/puppet/util/windows/adsi.rb', line 110 def uri(name, host = '.') host = '.' if ['NT AUTHORITY', 'BUILTIN', Socket.gethostname].include?(host) # group or user account_type = self.name.split('::').last.downcase Puppet::Util::Windows::ADSI.uri(name, account_type, host) end |