ldap_help.module in Lightweight Directory Access Protocol (LDAP) 7.2
Same filename and directory in other branches
The ldaphelp module is a module to help admins debug ldap_integration modules.
File
ldap_help/ldap_help.moduleView source
<?php
/**
* @file
* The ldaphelp module is a module to help admins debug ldap_integration modules.
*/
/**
* Implements hook_menu().
*/
function ldap_help_menu() {
$items = [];
$items['admin/config/people/ldap/help'] = [
'title' => 'Help',
'type' => MENU_LOCAL_TASK,
'weight' => 9,
'description' => 'Debugging and Configuration Help with LDAP',
'file' => 'ldap_help.resources.inc',
'page callback' => 'ldap_help_main',
'access arguments' => [
'administer site configuration',
],
];
$items['admin/config/people/ldap/help/intro'] = [
'title' => 'Resources',
'type' => MENU_DEFAULT_LOCAL_TASK,
];
$items['admin/config/people/ldap/help/status'] = [
'title' => 'Status',
'description' => 'LDAP status page',
'page callback' => 'ldap_help_status',
'access arguments' => [
'administer site configuration',
],
'file' => 'ldap_help.status.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 4,
];
$items['admin/config/people/ldap/help/watchdog'] = [
'title' => 'Watchdog',
'description' => 'LDAP watchdog logs',
'page callback' => 'ldap_help_watchdog',
'access arguments' => [
'administer site configuration',
],
'file' => 'ldap_help.watchdog.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 5,
];
$items['admin/config/people/ldap/help/issues'] = [
'title' => 'Issue Reporting',
'description' => 'Creating LDAP Issue Queue Items',
'page callback' => 'ldap_help_issues',
'access arguments' => [
'administer site configuration',
],
'file' => 'ldap_help.issues.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 7,
];
$items['admin/config/people/ldap/help/examples'] = [
'title' => 'Sample LDAPs',
'description' => 'Sample LDAPs from Documentation',
'page callback' => 'ldap_help_examples',
'access arguments' => [
'administer site configuration',
],
'file' => 'ldap_help.examples.inc',
'type' => MENU_LOCAL_TASK,
'weight' => 7,
];
return $items;
}
/**
*
*/
function ldap_help_form_ldap_servers_settings_alter(&$form, &$form_state) {
$form['watchdog_detail'] = [
'#type' => 'fieldset',
'#title' => t('Development'),
];
$form['watchdog_detail']['watchdog_detail'] = [
'#type' => 'checkbox',
'#title' => t('Enabled Detailed LDAP Watchdog logging. This is generally for
debugging and reporting issues with the ldap modules and should not be left
on.'),
'#default_value' => variable_get('ldap_help_watchdog_detail', 0),
];
$date = variable_get('ldap_help_user_data_clear_set_date', time());
$form['watchdog_detail']['user_data_clear'] = [
'#type' => 'checkbox',
'#title' => t('Discard and ignore user authorization data stored by ldap module in user records data before %date.
This is useful for implementers of development versions of the module
that may have corrupt user data from the past.', [
'%date' => date('Y-m-d H:i:s', $date),
]),
'#default_value' => variable_get('ldap_help_user_data_clear', 0),
];
$form['watchdog_detail']['user_data_clear_date'] = [
'#type' => 'checkbox',
'#title' => t('Reset the clear date to the current date %date', [
'%date' => date('Y-m-d H:i:s'),
]),
'#default_value' => variable_get('ldap_help_user_data_clear_set_date', 0),
];
$form['#submit'][] = 'ldap_help_watchdog_detail_submit';
}
/**
*
*/
function ldap_help_watchdog_detail_submit($form, &$form_state) {
if ($form_state['submitted']) {
$watchdog_detail = $form_state['values']['watchdog_detail'];
if ($watchdog_detail != variable_get('ldap_help_watchdog_detail', 0)) {
variable_set('ldap_help_watchdog_detail', $watchdog_detail);
}
if ($form_state['values']['user_data_clear'] != variable_get('ldap_help_user_data_clear', 0)) {
variable_set('ldap_help_user_data_clear', $form_state['values']['user_data_clear']);
}
if ($form_state['values']['user_data_clear_date'] != 0) {
variable_set('ldap_help_user_data_clear_set_date', time());
}
}
}
/**
*
*/
function ldap_help_help($path, $arg) {
$help = '<h3>' . t('LDAP Help Module') . '</h3><p>' . t('This module assists Drupal admins in configuring, debugging, sharing, and submitting
support and bug request related to LDAP modules.') . '<strong><em> ' . t('LDAP Help Module should be disabled unless you are debugging or configuring
LDAP problems.') . ' </em></strong>' . t('It adds no functionality to the LDAP modules.') . '</p>';
switch ($path) {
case 'admin/config/people/ldap/help':
$output = '<p>' . $help . '</p>';
return $output;
case 'admin/help#ldap_help':
$output = '<p>' . $help . '</p>';
return $output;
}
}
Functions
Name | Description |
---|---|
ldap_help_form_ldap_servers_settings_alter | |
ldap_help_help | |
ldap_help_menu | Implements hook_menu(). |
ldap_help_watchdog_detail_submit |