16 lines
		
	
	
		
			420 B
		
	
	
	
		
			Ruby
		
	
	
	
			
		
		
	
	
			16 lines
		
	
	
		
			420 B
		
	
	
	
		
			Ruby
		
	
	
	
| #encoding: utf-8
 | |
| require 'mysql2'
 | |
| 
 | |
| $nccu_ldap_connection
 | |
| 
 | |
| module  NccuLdapConnection
 | |
|   BASE = 'ou=People,dc=nccu,dc=edu,dc=tw'
 | |
| 
 | |
|   def self.establish
 | |
|       $nccu_ldap_connection = Net::LDAP.new
 | |
|       $nccu_ldap_connection.port =LDAP_CONFIG["port"]
 | |
|       $nccu_ldap_connection.host = LDAP_CONFIG["host"]
 | |
|       $nccu_ldap_connection.authenticate(LDAP_CONFIG["authenticate_info"],LDAP_CONFIG["authenticate_pwd"]) 
 | |
|   end
 | |
| 
 | |
| end |