diff --git a/config/initializers/nccu_ldap_connection.rb b/config/initializers/nccu_ldap_connection.rb new file mode 100644 index 00000000..35e9ded8 --- /dev/null +++ b/config/initializers/nccu_ldap_connection.rb @@ -0,0 +1,25 @@ +#encoding: utf-8 +require 'mysql2' + +$nccu_ldap_connection + +module NccuLdapConnection + BASE = 'ou=People,dc=nccu,dc=edu,dc=tw' + + @ldap_host = { + :host => '127.0.0.1', #140.119.166.23 or 127.0.0.1 + :port => 8001, #389 or 8001 + # :filter => "(uid=#{login_uid})", + # :base => "ou=People,dc=nccu,dc=edu,dc=tw", + :authenticate_info => "cn=uccn,ou=profile,dc=nccu,dc=edu,dc=tw", + :authenticate_pwd => "nccu2ucc" + } + + def self.establish + $nccu_ldap_connection = Net::LDAP.new + $nccu_ldap_connection.port = @ldap_host[:port] + $nccu_ldap_connection.host = @ldap_host[:host] + $nccu_ldap_connection.authenticate(@ldap_host[:authenticate_info],@ldap_host[:authenticate_pwd]) + end + +end \ No newline at end of file diff --git a/config/nccu_mid_site.yml b/config/nccu_mid_site.yml deleted file mode 100644 index d6b35603..00000000 --- a/config/nccu_mid_site.yml +++ /dev/null @@ -1,9 +0,0 @@ -nccu_mid_site: - adapter: mysql2 - encoding: utf8 - reconnect: true - database: RSS23_NCCU_MIDDLE - pool: 5 - username: rulingcom - password: 5w3iJQ9OJQMGhJibKP6YQje8 - socket: /tmp/mysql.sock \ No newline at end of file