function ldapgroups_admin_edit in LDAP integration 5
Same name and namespace in other branches
- 5.2 ldapgroups.module \ldapgroups_admin_edit()
- 6 ldapgroups.admin.inc \ldapgroups_admin_edit()
1 string reference to 'ldapgroups_admin_edit'
- ldapgroups_menu in ./
ldapgroups.module - Implementation of hook_menu()
File
- ./
ldapgroups.module, line 104
Code
function ldapgroups_admin_edit() {
$sid = arg(4);
if (arg(3) == 'reset' && is_numeric($sid)) {
$form['sid'] = array(
'#type' => 'value',
'#value' => $sid,
);
return confirm_form($form, t('Are you sure you want to reset the groups mapping to defaults ?'), 'admin/settings/ldapgroups', t('<em>This action cannot be undone.</p>'), t('Reset'), t('Cancel'));
}
elseif (arg(3) == 'edit' && $sid) {
$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 sid = %d", $sid));
$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' => '<fieldset><legend>',
'#suffix' => '</legend>',
);
$form['server-settings']['ldap_groups_in_dn_desc'] = array(
'#value' => '<p>Check this option if your users\' DNs look like <em style="font-style: normal; padding: 1px 3px; border: 1px solid #8888CC; background-color: #DDDDFF">cn=jdoe,<strong>ou=Group1</strong>,cn=example,cn=com</em> and <em style="font-style: normal; padding: 1px 3px; border: 1px solid #8888CC; background-color: #DDDDFF">Group1</em> turns out to be the group you want.</p>',
);
$form['server-settings']['ldap_group_dn_attribute'] = array(
'#type' => 'textfield',
'#title' => t('Attribute of the DN which contains the group name'),
'#default_value' => $edit['ldap_group_dn_attribute'],
'#size' => 50,
'#maxlength' => 255,
'#description' => t('The name of the attribute which contains the group name. In the example above, it would be <em style="font-style: normal; padding: 1px 3px; border: 1px solid #8888CC; background-color: #DDDDFF">ou</em>, as the DN contains the string <em style="font-style: normal; padding: 1px 3px; border: 1px solid #8888CC; background-color: #DDDDFF">ou=Group1</em> and <em style="font-style: normal; padding: 1px 3px; border: 1px solid #8888CC; background-color: #DDDDFF">Group1</em> happens to be the desired group name.'),
'#suffix' => '</fieldset>',
);
$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' => '<fieldset><legend>',
'#suffix' => '</legend>',
);
$form['server-settings']['ldap_group_attr'] = array(
'#type' => 'textarea',
'#title' => t('Attribute names (one per line)'),
'#default_value' => $edit['ldap_group_attr'],
'#cols' => 50,
'#rows' => 6,
'#description' => t('If the groups are stored in the user entries, along with the rest of their data, then enter here a list of attributes which may contain them.'),
'#suffix' => '</fieldset>',
);
$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' => '<fieldset><legend>',
'#suffix' => '</legend>',
);
$form['server-settings']['ldap_group_entries'] = array(
'#type' => 'textarea',
'#title' => t('Nodes containing groups (one per line)'),
'#default_value' => $edit['ldap_group_entries'],
'#cols' => 50,
'#rows' => 6,
'#description' => t('Enter here a list of nodes from where groups should be searched for. The module will look them up recursively from the given nodes.'),
);
$form['server-settings']['ldap_group_entries_attribute'] = array(
'#type' => 'textfield',
'#title' => t('Attribute holding group members'),
'#default_value' => $edit['ldap_group_entries_attribute'],
'#size' => 50,
'#maxlength' => 255,
'#description' => t('Name of the multivalued attribute which holds the CNs of group members, for example: !attr', array(
'!attr' => theme('placeholder', LDAP_DEFAULT_GROUP_ENTRIES_ATTRIBUTE),
)),
);
$form['sid'] = array(
'#type' => 'hidden',
'#value' => $sid,
);
$form['submit'] = array(
'#type' => 'submit',
'#value' => 'Save configuration',
);
}
return $form;
}