summaryrefslogtreecommitdiff
path: root/site-ruby/myldap.rb
diff options
context:
space:
mode:
Diffstat (limited to 'site-ruby/myldap.rb')
-rw-r--r--site-ruby/myldap.rb16
1 files changed, 13 insertions, 3 deletions
diff --git a/site-ruby/myldap.rb b/site-ruby/myldap.rb
index 115d772..7705029 100644
--- a/site-ruby/myldap.rb
+++ b/site-ruby/myldap.rb
@@ -11,17 +11,27 @@ class MyLDAP
if use
@binddn = config['credentials'][use]['binddn']
@bindpw = config['credentials'][use]['bindpw']
- else
+ elsif File.exists? File.expand_path('~/.noreply.ldap')
myconfig = YAML::load( File.open( File.expand_path('~/.noreply.ldap') ) )
@binddn = myconfig['binddn']
@bindpw = myconfig['bindpw']
end
- unless @conn.bind(@binddn, @bindpw)
- @conn.perror("bind")
+ if @binddn and @bindpw
+ unless @conn.bind(@binddn, @bindpw)
+ @conn.perror("bind")
+ end
end
end
def add(dn, data)
+ puts "dn: #{dn}"
+ data.each_pair{
+ |key, value|
+ value.each { |v|
+ puts "#{key}: #{v}"
+ }
+ }
+ puts
begin
entry = data.map{
|key, value|