ldapauth module.');
break;
case 'admin/settings/ldapgroups':
$output = t('Configure the Drupal Roles mapping with the LDAP Groups below. ');
$output .= t('Only the %activated LDAP configurations are listed. ', array('%activated' => 'activated'));
$output .= t('Additional LDAP Sources may be configured/enabled in the ');
$output .= l(t('!modulename', array('!modulename' => 'LDAP Integration')), 'admin/settings/ldapauth');
$output .= t(' administration area.
PLEASE NOTE: advanced configuration for this module can be set by editing the module\'s config file, located at modules/ldap_integration/ldap_integration/ldapgroups.conf.php in your Drupal install.
');
break;
}
return $output;
}
/**
* Implementation of hook_menu()
*/
function ldapgroups_menu($may_cache) {
$items = array();
if ($may_cache) {
$items[] = array(
'path' => 'admin/settings/ldapgroups',
'title' => t('LDAP Groups'),
'description' => t('Configure LDAP Groups Settings'),
'callback' => 'ldapgroups_admin_list',
'access' => user_access('administer ldap modules'),
);
$items[] = array(
'path' => 'admin/settings/ldapgroups/edit',
'title' => t('LDAP Groups'),
'callback' => 'drupal_get_form',
'callback arguments' => array('ldapgroups_admin_edit'),
'type' => MENU_CALLBACK,
'weight' => 1,
'access' => user_access('administer ldap modules'),
);
$items[] = array(
'path' => 'admin/settings/ldapgroups/reset',
'title' => t('LDAP Groups'),
'callback' => 'drupal_get_form',
'callback arguments' => array('ldapgroups_admin_edit'),
'type' => MENU_CALLBACK,
'weight' => 1,
'access' => user_access('administer ldap modules'),
);
}
return $items;
}
function ldapgroups_admin_list() {
$result = db_query("SELECT sid, name FROM {ldapauth} WHERE status = '%s' ORDER BY sid", 1);
$rows = array();
while ($row = db_fetch_object($result)) {
$rows[] = array($row->name, l(t('edit'), 'admin/settings/ldapgroups/edit/'.$row->name), l(t('reset'), 'admin/settings/ldapgroups/reset/'.$row->name));
}
$header = array(
t('LDAP Config'),
array(
'data' => t('Operations'),
'colspan' => 2
)
);
return theme('table', $header, $rows);
}
function ldapgroups_admin_edit($ldap_name) {
if ((arg(3) == 'reset') && ($ldap_name != NULL)) {
$form['reset_ldap'] = array(
'#type' => 'value',
'#value' => $ldap_name,
);
return confirm_form(
$form,
t('Are you sure you want to reset the groups mapping to defaults ?'),
'admin/settings/ldapgroups',
t('This action cannot be undone.'),
t('Reset'),
t('Cancel')
);
}
elseif ((arg(3) == 'edit') && ($ldap_name != NULL)) {
$edit = db_fetch_array(db_query("SELECT ldap_groups_in_dn, ldap_groups_in_dn_desc, ldap_group_dn_attribute, ldap_groups_in_attr, ldap_group_attr, ldap_groups_as_entries, ldap_group_entries, ldap_group_entries_attribute FROM {ldapauth} WHERE name = '%s'", $ldap_name));
$form['server-settings']['ldap_groups_in_dn'] = array(
'#type' => 'checkbox',
'#title' => t('Group is specified in user\'s DN'),
'#default_value' => $edit['ldap_groups_in_dn'],
'#prefix' => ''
);
$form['server-settings']['ldap_groups_in_attr'] = array(
'#type' => 'checkbox',
'#title' => t('Groups are specified by LDAP attributes'),
'#default_value' => $edit['ldap_groups_in_attr'],
'#prefix' => ''
);
$form['server-settings']['ldap_groups_as_entries'] = array(
'#type' => 'checkbox',
'#title' => t('Groups exist as LDAP entries where a multivalued attribute contains the members\' CNs'),
'#default_value' => $edit['ldap_groups_as_entries'],
'#prefix' => '