lib/qooxview/storages/ldap.rb in qooxview-1.9.9 vs lib/qooxview/storages/ldap.rb in qooxview-1.9.10

- old
+ new

@@ -1,12 +1,13 @@ require 'net/ldap' -require 'parseconfig' +require 'iniparse' class LDAP < StorageType attr_accessor :data_ldap_base, :data_ldap_users def self.get_config_file(first, second, config) + #dputs_func file = get_config(first, :LDAPConfig, config) if !File.exists?(file) file = second end if !File.exists?(file) @@ -18,22 +19,23 @@ end # Load the configuration file and set up different variables # for LDAP. This has to be loaded just once def configure(config) + #dputs_func dputs(2) { "Configuring LDAP: #{config.inspect}" } if conf = get_config(nil, :LDAPConfig, :array) @data_ldap_host, @data_ldap_base, @data_ldap_root, @data_ldap_users, @data_ldap_pass = conf else file_conf = LDAP.get_config_file('ldapscripts.conf', '/etc/ldapscripts/ldapscripts.conf', :ldapscripts) - ldap_config = ParseConfig.new(file_conf) + ldap_config = IniParse.parse(File.read(file_conf)) dputs(2) { "Configuration options are #{ldap_config.get_params.inspect}" } @data_ldap_host, @data_ldap_base, @data_ldap_root, @data_ldap_users = - ldap_config.params['SERVER'], ldap_config.params['SUFFIX'], ldap_config.params['BINDDN'], - ldap_config.params['USUFFIX'] + ldap_config['SERVER'], ldap_config['SUFFIX'], ldap_config['BINDDN'], + ldap_config['USUFFIX'] file_pass = LDAP.get_config_file('ldap.secret', '/etc/ldap.secret', :ldapsecret) @data_ldap_pass = `cat #{ file_pass }` end @@ -58,9 +60,10 @@ def save(data, notmp: false) dputs(3) { 'Everything should already be saved...' } end def load + #dputs_func data = {} # Read in the entries from the LDAP-directory dputs(3) { 'Reading LDAP-entries' } filter = Net::LDAP::Filter.eq('cn', '*') @field_id_ldap = @fields[@data_field_id][:ldap_name].to_sym