You are here

public function LdapAuthenticationConfAdmin::validate in Lightweight Directory Access Protocol (LDAP) 7

Same name and namespace in other branches
  1. 8.2 ldap_authentication/LdapAuthenticationConfAdmin.class.php \LdapAuthenticationConfAdmin::validate()
  2. 7.2 ldap_authentication/LdapAuthenticationConfAdmin.class.php \LdapAuthenticationConfAdmin::validate()

validate object, not form

1 call to LdapAuthenticationConfAdmin::validate()
LdapAuthenticationConfAdmin::drupalFormValidate in ldap_authentication/LdapAuthenticationConfAdmin.class.php
validate form, not object

File

ldap_authentication/LdapAuthenticationConfAdmin.class.php, line 528

Class

LdapAuthenticationConfAdmin

Code

public function validate() {
  $errors = array();
  $enabled_servers = ldap_servers_get_servers(NULL, 'enabled');
  if ($this->ssoEnabled) {
    foreach ($this->sids as $sid) {
      if ($enabled_servers[$sid]->bind_method == LDAP_SERVERS_BIND_METHOD_USER || $enabled_servers[$sid]->bind_method == LDAP_SERVERS_BIND_METHOD_ANON_USER) {
        $methods = array(
          LDAP_SERVERS_BIND_METHOD_USER => 'Bind with Users Credentials',
          LDAP_SERVERS_BIND_METHOD_ANON_USER => 'Anonymous Bind for search, then Bind with Users Credentials',
        );
        $tokens = array(
          '!edit' => l($enabled_servers[$sid]->name, LDAP_SERVERS_INDEX_BASE_PATH . '/edit/' . $sid),
          '%sid' => $sid,
          '%bind_method' => $methods[$enabled_servers[$sid]->bind_method],
        );
        $errors['ssoEnabled'] = t('Single Sign On is not valid with the server !edit (id=%sid) because that server configuration uses %bind_method.  Since the user\'s credentials are never available to this module with single sign on enabled, there is no way for the ldap module to bind to the ldap server with credentials.', $tokens);
      }
    }
  }
  return $errors;
}