put ldap setting into config file. should load be rails env. Also make god config more friendly.
This commit is contained in:
1 parent
8dd1ab32c1
commit
86a4a6cbe2
4 files changed
+30
-16
No files matched your search
@@ -1 +1,2 @@
|
||||
APP_CONFIG = YAML.load_file("#{Rails.root}/config/config.yml")[Rails.env]
|
||||
LDAP_CONFIG = YAML.load_file("#{Rails.root}/config/ldap.yml")[Rails.env]
|
||||
@@ -6,20 +6,11 @@ $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])
|
||||
$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
|
||||
Reference in new issue
Block a user