module Tapjoy::LDAP::Audit
Constants
- SUB_COMMANDS
Public Class Methods
by_group()
click to toggle source
# File lib/tapjoy/ldap/audit.rb, line 27 def by_group audit = Tapjoy::LDAP::Audit::ByGroup.new audit.by_group end
by_user()
click to toggle source
# File lib/tapjoy/ldap/audit.rb, line 32 def by_user audit = Tapjoy::LDAP::Audit::ByUser.new audit.by_user end
commands()
click to toggle source
# File lib/tapjoy/ldap/audit.rb, line 9 def commands Optimist.options do usage 'user [SUB_COMMAND] [options]' synopsis "\nThis object is used for auditing LDAP permissions\nAvailable subcommands are: #{SUB_COMMANDS}" stop_on SUB_COMMANDS end cmd = ARGV.shift case cmd when 'by_user', 'by_group', 'raw' send(cmd) # call method with respective name else raise Tapjoy::LDAP::InvalidArgument end end
get_groups_with_membership()
click to toggle source
Get hash of groups with list of members of each group
# File lib/tapjoy/ldap/audit.rb, line 42 def get_groups_with_membership filter = Net::LDAP::Filter.eq('objectclass', 'posixGroup') attributes = %w(cn memberUid) results = Tapjoy::LDAP.client.search(attributes, filter) end
print_hash(header_string, object_hash)
click to toggle source
Clean output of hashes
# File lib/tapjoy/ldap/audit.rb, line 51 def print_hash(header_string, object_hash) puts header_string puts "=" * header_string.length object_hash.each_pair do |key, values| next if values.empty? puts "- #{key}" values.each { |value| puts " - #{value}" } end end
raw()
click to toggle source
# File lib/tapjoy/ldap/audit.rb, line 37 def raw puts Tapjoy::LDAP.client.search.inspect end