Skip to content

Commit

Permalink
Merge pull request #1 from YaleUniversity/mods_for_v2.0.1
Browse files Browse the repository at this point in the history
Mods for v3.0.0 (was Mods for v2.0.1)
  • Loading branch information
vbalbarin authored Jul 6, 2017
2 parents 805c8f7 + 0cda58e commit 37f3323
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion examples/get_computer_dn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
c = AdManagement::Client.new(conf).connect!

## Display a computer accounts DistinguishedName
puts c.get(computer_cn + '$')
puts c.get(computer_cn)
11 changes: 6 additions & 5 deletions lib/ad_management/objects/computer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ module Objects
module Computer
##
# Gets the dn of a computer object
def get(sam_account_name)
raise AdManagement::ArgumentError, 'Required parameter sam_account_name not provided!' if sam_account_name.nil?
@logger.info("Getting DN of #{sam_account_name}")
dn = search(sam_account_name + '$').first&.dn || ''
def get(cn)
raise AdManagement::ArgumentError, 'Required parameter cn not provided!' if cn.nil?
@logger.info("Getting DN of #{cn}")
dn = search(cn + '$').first&.dn || ''
dn
end

Expand Down Expand Up @@ -39,7 +39,8 @@ def create(cn, ou, managed_by)
objectClass: %w[computer organizationalPerson person top user],
cn: cn,
sAMAccountName: cn + '$',
managedBy: managed_by_dn
managedBy: managed_by_dn,
userAccountControl: '4096'
}
)
return "CN=#{cn},#{ou}" if result
Expand Down
2 changes: 1 addition & 1 deletion lib/ad_management/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module AdManagement
VERSION = '2.0.0'.freeze
VERSION = '3.0.0'.freeze
end

0 comments on commit 37f3323

Please sign in to comment.