You are here

function ldaphelp_get_ldapauth in LDAP integration 6

Create a readable version of the common LDAPAuth settings

Parameters

Array $info A Array of the information found:

Return value

An array used by the status report.

1 call to ldaphelp_get_ldapauth()
ldaphelp_status in ldaphelp/ldaphelp_status.inc

File

ldaphelp/ldaphelp_status.inc, line 141
status file for ldaphelp module

Code

function ldaphelp_get_ldapauth(&$info) {
  $info['ldapauth']['login_process_text'] = LDAPAUTH_LOGIN_PROCESS == LDAPAUTH_AUTH_EXCLUSIVED ? "LDAP directory only" : "Mixed Mode";
  $info['ldapauth']['login_process_text'] .= " (" . LDAPAUTH_LOGIN_PROCESS . ')';
  $info['ldapauth']['login_conflict_text'] = LDAPAUTH_LOGIN_CONFLICT == LDAPAUTH_CONFLICT_RESOLVE ? "Associate local account with the ldap entry" : "Disallow login and log the conflict";
  $info['ldapauth']['login_conflict_text'] .= "  (" . LDAPAUTH_LOGIN_CONFLICT . ')';

  // Authentication mode settings
  $status[] = array(
    'title' => 'Authentication mode',
    value => $info['ldapauth']['login_process_text'],
    'severity' => "0",
  );
  $status[] = array(
    'title' => 'Conflict Resolve Feature',
    value => $info['ldapauth']['login_conflict_text'],
    'severity' => "0",
  );

  // Security options settings
  $info['ldapauth']['ldapauth_disable_pass_change_text'] = LDAPAUTH_FORGET_PASSWORDS == TRUE ? "Do not " : "Do";
  $info['ldapauth']['ldapauth_disable_pass_change_text'] .= 'store users\' passwords during sessions.';
  $status[] = array(
    'title' => 'Security: Store Passwords',
    value => $info['ldapauth']['ldapauth_disable_pass_change_text'],
    'severity' => "0",
  );
  $info['ldapauth']['ldapauth_disable_pass_change_text'] = LDAPAUTH_SYNC_PASSWORDS == FALSE ? "Do not " : "Do";
  $info['ldapauth']['ldapauth_disable_pass_change_text'] .= 'sync LDAP password with the Drupal password';
  $status[] = array(
    'title' => 'Security: Sync Passwords',
    value => $info['ldapauth']['ldapauth_disable_pass_change_text'],
    'severity' => "0",
  );
  $create_users = variable_get('ldapauth_create_users', TRUE);
  $info['ldapauth']['ldapauth_disable_pass_change_text'] = $create_users_ == FALSE ? "Do not " : "Do";
  $info['ldapauth']['ldapauth_disable_pass_change_text'] .= 'create new Drupal users if not present.';
  $status[] = array(
    'title' => 'Security: New Users',
    value => $info['ldapauth']['ldapauth_disable_pass_change_text'],
    'severity' => "0",
  );

  // UI Options settings
  switch (LDAPAUTH_ALTER_USERNAME_FIELD) {
    case 0:
      $alter_type = "Do nothing ( 0 )";
      break;
    case 1:
      $alter_type = "Remove username field from form ( 1 )";
      break;
    case 2:
      $alter_type = "Disable username field on form ( 2 )";
      break;
    default:
      $alter_type = "UNKNOWN ACTION ( " . LDAPAUTH_ALTER_USERNAME_FIELD . ")";
  }
  $info['ldapauth']['ldapauth_disable_pass_change_text'] = $alter_type;
  $status[] = array(
    'title' => 'UI: Username Field',
    value => $info['ldapauth']['ldapauth_disable_pass_change_text'],
    'severity' => "0",
  );
  $info['ldapauth']['ldapauth_disable_pass_change_text'] = LDAPAUTH_DISABLE_PASS_CHANGE == TRUE ? "R" : "Do not R";
  $info['ldapauth']['ldapauth_disable_pass_change_text'] .= 'emove password change fields from user edit form';
  $status[] = array(
    'title' => 'UI: Password Field',
    value => $info['ldapauth']['ldapauth_disable_pass_change_text'],
    'severity' => "0",
  );
  switch (LDAPAUTH_ALTER_EMAIL_FIELD) {
    case 0:
      $alter_type = "Do nothing ( 0 )";
      break;
    case 1:
      $alter_type = "Remove email field from form ( 1 )";
      break;
    case 2:
      $alter_type = "Disable email field on form ( 2 )";
      break;
    default:
      $alter_type = "UNKNOWN ACTION ( " . LDAPAUTH_ALTER_EMAIL_FIELD . ")";
  }
  $info['ldapauth']['ldapauth_disable_pass_change_text'] = $alter_type;
  $status[] = array(
    'title' => 'UI: Email Field',
    value => $info['ldapauth']['ldapauth_disable_pass_change_text'],
    'severity' => "0",
  );
  $disable_picture = variable_get('ldapdata_disable_picture_change', NULL);
  if ($disable_picture !== NULL) {
    $info['ldapauth']['ldapauth_disable_pass_change_text'] = $disable_picture == TRUE ? "R" : "Do not R";
    $info['ldapauth']['ldapauth_disable_pass_change_text'] .= 'emove picture change fields from user edit form';
    $status[] = array(
      'title' => 'UI: Picture Field',
      value => $info['ldapauth']['ldapauth_disable_pass_change_text'],
      'severity' => "0",
    );
  }
  return $status;
}