You are here

function ldap_help_get_ldap_authorization in Lightweight Directory Access Protocol (LDAP) 8.2

Same name and namespace in other branches
  1. 7.2 ldap_help/ldap_help.status.inc \ldap_help_get_ldap_authorization()
  2. 7 ldap_help/ldap_help.status.inc \ldap_help_get_ldap_authorization()
1 call to ldap_help_get_ldap_authorization()
ldap_help_status in ldap_help/ldap_help.status.inc
@file status file for ldaphelp module

File

ldap_help/ldap_help.status.inc, line 360
status file for ldaphelp module

Code

function ldap_help_get_ldap_authorization() {
  $status = array();
  ldap_servers_module_load_include('php', 'ldap_authorization', 'LdapAuthorizationConsumerConfAdmin.class');
  ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.settings');
  ldap_servers_module_load_include('inc', 'ldap_servers', 'ldap_servers.admin');
  $servers = ldap_servers_get_servers(NULL, 'enabled');
  $consumers = ldap_authorization_get_consumers();
  if (count($servers) == 0) {
    return array();
  }
  foreach ($servers as $sid => $server) {
    $server_options[$sid] = $server->name;
  }
  $items['status']['mapping_id'] = 'string';
  $items['status']['consumer_type'] = 'string';
  $items['status']['status'] = 'string';
  $items['status']['only_ldap_authenticated'] = 'string';

  // $items['filter_and_mappings']['mappings'] = 'string';
  $items['use_filter']['mappings'] = 'string';
  $items['misc_settings']['allow_synch_both_directions'] = 'string';
  $items['misc_settings']['synchronization_modes'] = 'string';
  $items['misc_settings']['synchronization_actions'] = 'string';
  foreach ($consumers as $consumer_type => $consumer) {
    $consumer_obj = ldap_authorization_get_consumer_object($consumer_type);
    $mapping_admin = new LdapAuthorizationConsumerConfAdmin($consumer_obj, FALSE);
    $authorization_form = $mapping_admin
      ->drupalForm($server_options, 'edit');
    $status[$consumer_type] = ldap_help_parse_form($authorization_form, $items);
    $maps = $authorization_form['filter_and_mappings']['mappings']['#default_value'];
    $map_content = trim($maps) ? "mappings present" : "empty";
    if ($map_content == 'data present') {
      $map_content .= $maps == drupal_strtolower($maps) ? ', lower case' : ', mixed case';
    }
    $status[$consumer_type][] = array(
      'title' => 'mappings',
      'value' => $map_content,
    );
  }
  return $status;
}