regulate some model attribute names. (#1303)

LGTM
This commit is contained in:
kun wang 2017-01-11 04:31:20 -06:00 committed by yhua123
parent a6a4a1fc18
commit 84509fbb3e
2 changed files with 10 additions and 10 deletions

View File

@ -18,11 +18,11 @@ package models
// LdapConf holds information about repository that accessed most
type LdapConf struct {
LdapURL string `json:"ldap_url"`
LdapSearchDn string `json:"ldap_searchdn"`
LdapSearchPwd string `json:"ldap_search_pwd"`
LdapBaseDn string `json:"ldap_basedn"`
LdapSearchDn string `json:"ldap_search_dn"`
LdapSearchPassword string `json:"ldap_search_password"`
LdapBaseDn string `json:"ldap_base_dn"`
LdapFilter string `json:"ldap_filter"`
LdapUID string `json:"ldap_uid"`
LdapScope int `json:"ldap_scope"`
LdapConnectTimeout int `json:"ldap_connect_timeout"`
LdapConnectionTimeout int `json:"ldap_connection_timeout"`
}

View File

@ -80,8 +80,8 @@ func validateLdapReq(ldapConfs models.LdapConf) error {
}
log.Debug("ldapURL:", ldapURL)
ldapConnectTimeout := ldapConfs.LdapConnectTimeout
log.Debug("ldapConnectTimeout:", ldapConnectTimeout)
ldapConnectionTimeout := ldapConfs.LdapConnectionTimeout
log.Debug("ldapConnectionTimeout:", ldapConnectionTimeout)
return nil
@ -128,8 +128,8 @@ func connectTest(ldapConfs models.LdapConf) error {
}
// Sets a Dial Timeout for LDAP
connectTimeout := ldapConfs.LdapConnectTimeout
goldap.DefaultTimeout = time.Duration(connectTimeout) * time.Second
connectionTimeout := ldapConfs.LdapConnectionTimeout
goldap.DefaultTimeout = time.Duration(connectionTimeout) * time.Second
switch protocol {
case "ldap":
@ -146,8 +146,8 @@ func connectTest(ldapConfs models.LdapConf) error {
ldapSearchDn := ldapConfs.LdapSearchDn
if ldapSearchDn != "" {
log.Debug("Search DN: ", ldapSearchDn)
ldapSearchPwd := ldapConfs.LdapSearchPwd
err = ldap.Bind(ldapSearchDn, ldapSearchPwd)
ldapSearchPassword := ldapConfs.LdapSearchPassword
err = ldap.Bind(ldapSearchDn, ldapSearchPassword)
if err != nil {
log.Debug("Bind search dn error", err)
return err