function cas_ldap_form_cas_attributes_admin_settings_alter in CAS Attributes 6.3
Same name and namespace in other branches
- 7 cas_ldap.module \cas_ldap_form_cas_attributes_admin_settings_alter()
Administrative settings form.
File
- ./
cas_ldap.module, line 46 - Allows user account and profile attributes to be automatically populated using tokens. Provides basic tokens for attributes returned by an LDAP server.
Code
function cas_ldap_form_cas_attributes_admin_settings_alter(&$form, &$form_state) {
$cas_attributes = variable_get('cas_attributes', array());
$cas_attributes += array(
'ldap' => array(
'server' => NULL,
),
);
$form['cas_attributes']['ldap'] = array(
'#type' => 'fieldset',
'#title' => 'LDAP',
'#tree' => TRUE,
'#weight' => -8,
);
// Since there is no API for ldap_integration, do SQL query manually:
$result = db_query("SELECT sid, name FROM {ldapauth} WHERE status = 1 ORDER BY weight");
$options = array();
while ($ldap_server = db_fetch_object($result)) {
$options[$ldap_server->sid] = $ldap_server->name;
}
$form['cas_attributes']['ldap']['server'] = array(
'#type' => 'select',
'#title' => t('Server'),
'#default_value' => $cas_attributes['ldap']['server'],
'#options' => $options,
'#empty_option' => t('- Select a LDAP server -'),
'#description' => t('The LDAP server to query for LDAP attributes. <a href="@url">Configure servers</a>.', array(
'@url' => url('admin/settings/ldap/ldapauth/list'),
)),
);
}