You are here

protected function LdapServerAdmin::warnings in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 7.2 ldap_servers/LdapServerAdmin.class.php \LdapServerAdmin::warnings()
  2. 7 ldap_servers/LdapServerAdmin.class.php \LdapServerAdmin::warnings()
1 call to LdapServerAdmin::warnings()
LdapServerAdmin::drupalFormWarnings in ldap_servers/LdapServerAdmin.class.php

File

ldap_servers/LdapServerAdmin.class.php, line 402

Class

LdapServerAdmin

Code

protected function warnings($op, $has_errors = NULL) {
  $warnings = array();
  if ($this->ldap_type) {
    $defaults = ldap_servers_ldaps_option_array();
    if (isset($defaults['user']['user_attr']) && $this->user_attr != $defaults['user']['user_attr']) {
      $tokens = array(
        '%name' => $defaults['name'],
        '%default' => $defaults['user']['user_attr'],
        '%user_attr' => $this->user_attr,
      );
      $warnings['user_attr'] = t('The standard UserName attribute in %name is %default.  You have %user_attr. This may be correct
          for your particular LDAP.', $tokens);
    }
    if (isset($defaults['user']['mail_attr']) && $this->mail_attr && $this->mail_attr != $defaults['user']['mail_attr']) {
      $tokens = array(
        '%name' => $defaults['name'],
        '%default' => $defaults['user']['mail_attr'],
        '%mail_attr' => $this->mail_attr,
      );
      $warnings['mail_attr'] = t('The standard mail attribute in %name is %default.  You have %mail_attr.  This may be correct
          for your particular LDAP.', $tokens);
    }
  }

  //  if (!$this->status && $has_errors != TRUE) {
  //  $warnings['status'] =  t('This server configuration is currently disabled.');
  // }
  if (!$this->mail_attr && !$this->mail_template) {
    $warnings['mail_attr'] = t('Mail attribute or Mail Template should be used for most user account functionality.');
  }

  // commented out validation because too many false positives present usability errors.
  // if ($this->bind_method == LDAP_SERVERS_BIND_METHOD_SERVICE_ACCT) { // Only for service account
  // $result = ldap_baddn($this->binddn, t('Service Account DN'));
  // if ($result['boolean'] == FALSE) {
  //   $warnings['binddn'] =  $result['text'];
  // }
  // }
  // foreach ($this->basedn as $basedn) {
  //  $result = ldap_baddn($basedn, t('User Base DN'));
  // if ($result['boolean'] == FALSE) {
  //   $warnings['basedn'] =  $result['text'];
  //  }
  // }
  // $result = ldap_badattr($this->user_attr, t('User attribute'));
  // if ($result['boolean'] == FALSE) {
  //  $warnings['user_attr'] =  $result['text'];
  // }
  // if ($this->mail_attr) {
  //    $result = ldap_badattr($this->mail_attr, t('Mail attribute'));
  //   if ($result['boolean'] == FALSE) {
  //    $warnings['mail_attr'] =  $result['text'];
  //   }
  //  }
  // $result = ldap_badattr($this->unique_persistent_attr, t('Unique Persistent Attribute'));
  // if ($result['boolean'] == FALSE) {
  //  $warnings['unique_persistent_attr'] =  $result['text'];
  // }
  return $warnings;
}