You are here

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

Same name and namespace in other branches
  1. 8.2 ldap_authentication/LdapAuthenticationConfAdmin.class.php \LdapAuthenticationConfAdmin::validate()
  2. 7 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 607

Class

LdapAuthenticationConfAdmin

Code

public function validate() {
  $errors = [];
  $enabled_servers = ldap_servers_get_servers(NULL, 'enabled');
  if ($this->ssoEnabled) {
    foreach ($this->sids as $sid => $discard) {
      if ($enabled_servers[$sid]->bind_method == LDAP_SERVERS_BIND_METHOD_USER || $enabled_servers[$sid]->bind_method == LDAP_SERVERS_BIND_METHOD_ANON_USER) {
        $methods = [
          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 = [
          '!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;
}