public function LdapAuthenticationConfAdmin::drupalForm in Lightweight Directory Access Protocol (LDAP) 7.2
Same name and namespace in other branches
- 8.2 ldap_authentication/LdapAuthenticationConfAdmin.class.php \LdapAuthenticationConfAdmin::drupalForm()
- 7 ldap_authentication/LdapAuthenticationConfAdmin.class.php \LdapAuthenticationConfAdmin::drupalForm()
File
- ldap_authentication/
LdapAuthenticationConfAdmin.class.php, line 274
Class
Code
public function drupalForm() {
if (count($this->authenticationServersOptions) == 0) {
$message = ldap_servers_no_enabled_servers_msg('configure LDAP Authentication');
$form['intro'] = [
'#type' => 'item',
'#markup' => t('<h1>LDAP Authentication Settings</h1>') . $message,
];
return $form;
}
// Not sure what the tokens would be for this form?
$tokens = [];
$form['intro'] = [
'#type' => 'item',
'#markup' => t('<h1>LDAP Authentication Settings</h1>'),
];
$form['logon'] = [
'#type' => 'fieldset',
'#title' => t('Logon Options'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
];
$form['logon']['authenticationMode'] = [
'#type' => 'radios',
'#title' => t('Allowable Authentications'),
'#required' => 1,
'#default_value' => $this->authenticationMode,
'#options' => $this->authenticationModeOptions,
];
$form['logon']['authenticationServers'] = [
'#type' => 'checkboxes',
'#title' => t('Authentication LDAP Server Configurations'),
'#required' => FALSE,
'#default_value' => $this->sids,
'#options' => $this->authenticationServersOptions,
'#description' => $this->authenticationServersDescription,
];
$form['login_UI'] = [
'#type' => 'fieldset',
'#title' => t('User Login Interface'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
];
$form['login_UI']['loginUIUsernameTxt'] = [
'#type' => 'textfield',
'#title' => t('Username Description Text'),
'#required' => 0,
'#default_value' => $this->loginUIUsernameTxt,
'#description' => $this->loginUIUsernameTxtDescription,
];
$form['login_UI']['loginUIPasswordTxt'] = [
'#type' => 'textfield',
'#title' => t('Password Description Text'),
'#required' => 0,
'#default_value' => $this->loginUIPasswordTxt,
'#description' => $this->loginUIPasswordTxtDescription,
];
$form['login_UI']['ldapUserHelpLinkUrl'] = [
'#type' => 'textfield',
'#title' => t('LDAP Account User Help URL'),
'#required' => 0,
'#default_value' => $this->ldapUserHelpLinkUrl,
'#description' => $this->ldapUserHelpLinkUrlDescription,
];
$form['login_UI']['ldapUserHelpLinkText'] = [
'#type' => 'textfield',
'#title' => t('LDAP Account User Help Link Text'),
'#required' => 0,
'#default_value' => $this->ldapUserHelpLinkText,
'#description' => $this->ldapUserHelpLinkTextDescription,
];
$form['restrictions'] = [
'#type' => 'fieldset',
'#title' => t('LDAP User "Whitelists" and Restrictions'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
];
$form['restrictions']['allowOnlyIfTextInDn'] = [
'#type' => 'textarea',
'#title' => t('Allow Only Text Test'),
'#default_value' => $this
->arrayToLines($this->allowOnlyIfTextInDn),
'#cols' => 50,
'#rows' => 3,
'#description' => t($this->allowOnlyIfTextInDnDescription, $tokens),
];
$form['restrictions']['excludeIfTextInDn'] = [
'#type' => 'textarea',
'#title' => t('Excluded Text Test'),
'#default_value' => $this
->arrayToLines($this->excludeIfTextInDn),
'#cols' => 50,
'#rows' => 3,
'#description' => t($this->excludeIfTextInDnDescription, $tokens),
];
$form['restrictions']['allowTestPhp'] = [
'#type' => 'textarea',
'#title' => t('PHP to Test for Allowed LDAP Users'),
'#default_value' => $this->allowTestPhp,
'#cols' => 50,
'#rows' => 3,
'#description' => t($this->allowTestPhpDescription, $tokens),
'#disabled' => (bool) (!module_exists('php')),
];
if (!module_exists('php')) {
$form['restrictions']['allowTestPhp']['#title'] .= ' <em>' . t('php module currently disabled') . '</em>';
}
$form['restrictions']['excludeIfNoAuthorizations'] = [
'#type' => 'checkbox',
'#title' => t('Deny access to users without Ldap Authorization Module
authorization mappings such as Drupal roles.
Requires LDAP Authorization to be enabled and configured!'),
'#default_value' => $this->excludeIfNoAuthorizations,
'#description' => t($this->excludeIfNoAuthorizationsDescription, $tokens),
'#disabled' => (bool) (!module_exists('ldap_authorization')),
];
$form['email'] = [
'#type' => 'fieldset',
'#title' => t('Email'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
];
$form['email']['emailOption'] = [
'#type' => 'radios',
'#title' => t('Email Behavior'),
'#required' => 1,
'#default_value' => $this->emailOption,
'#options' => $this->emailOptionOptions,
];
$form['email']['emailUpdate'] = [
'#type' => 'radios',
'#title' => t('Email Update'),
'#required' => 1,
'#default_value' => $this->emailUpdate,
'#options' => $this->emailUpdateOptions,
];
$form['email']['template'] = [
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#title' => t('Email Templates'),
];
$form['email']['template']['emailTemplateHandling'] = [
'#type' => 'radios',
'#title' => t('Email Template Handling'),
'#required' => 1,
'#default_value' => $this->emailTemplateHandling,
'#options' => $this->emailTemplateHandlingOptions,
];
$form['email']['template']['emailTemplate'] = [
'#type' => 'textfield',
'#title' => t('Email Template'),
'#required' => 0,
'#default_value' => $this->emailTemplate,
];
$form['email']['template']['templateUsageResolveConflict'] = [
'#type' => 'checkbox',
'#title' => t('If a Drupal account already exists with the same email, but different account name, use the email template instead of the LDAP email.'),
'#default_value' => $this->templateUsageResolveConflict,
];
$form['email']['template']['templateUsageNeverUpdate'] = [
'#type' => 'checkbox',
'#title' => t('Ignore the Email Update settings and never update the stored email if the template is used.'),
'#default_value' => $this->templateUsageNeverUpdate,
];
$form['email']['prompts'] = [
'#type' => 'fieldset',
'#collapsible' => TRUE,
'#title' => t('User Email Prompt'),
'#description' => t('These settings allow the user to fill in their email address after logging in if the template was used to generate their email address.'),
];
$form['email']['prompts']['templateUsagePromptUser'] = [
'#type' => 'checkbox',
'#title' => t('Prompt user for email on every page load.'),
'#default_value' => $this->templateUsagePromptUser,
];
$form['email']['prompts']['templateUsageRedirectOnLogin'] = [
'#type' => 'checkbox',
'#title' => t('Redirect the user to the form after logging in.'),
'#default_value' => $this->templateUsageRedirectOnLogin,
];
$form['email']['prompts']['templateUsagePromptRegex'] = [
'#type' => 'textfield',
'#default_value' => $this->templateUsagePromptRegex,
'#title' => t('Template Regex'),
'#description' => t('This regex will be used to determine if the template was used to create an account.'),
];
$form['password'] = [
'#type' => 'fieldset',
'#title' => t('Password'),
'#collapsible' => TRUE,
'#collapsed' => FALSE,
];
$form['password']['passwordOption'] = [
'#type' => 'radios',
'#title' => t('Password Behavior'),
'#required' => 1,
'#default_value' => $this->passwordOption,
'#options' => $this->passwordUpdateOptions,
];
/**
* Begin single sign-on settings
*/
$form['sso'] = [
'#type' => 'fieldset',
'#title' => t('Single Sign-On'),
'#collapsible' => TRUE,
'#collapsed' => (bool) (!$this->ssoEnabled),
];
if ($this->ssoEnabled) {
$form['sso']['enabled'] = [
'#type' => 'markup',
'#markup' => $this->ssoEnabledDescription,
];
}
else {
$form['sso']['disabled'] = [
'#type' => 'markup',
'#markup' => '<p><em>' . t('LDAP Single Sign-On module must be enabled for options below to work.') . ' ' . t('It is currently disabled.') . ' ' . l(t('See modules form'), 'admin/modules') . '</p></em>',
];
}
$form['sso']['ssoRemoteUserStripDomainName'] = [
'#type' => 'checkbox',
'#title' => t('Strip REMOTE_USER domain name'),
'#description' => t($this->ssoRemoteUserStripDomainNameDescription),
'#default_value' => $this->ssoRemoteUserStripDomainName,
'#disabled' => (bool) (!$this->ssoEnabled),
];
$form['sso']['seamlessLogin'] = [
'#type' => 'checkbox',
'#title' => t('Turn on automated/seamless single sign-on'),
'#description' => t($this->seamlessLogInDescription),
'#default_value' => $this->seamlessLogin,
'#disabled' => (bool) (!$this->ssoEnabled),
];
$form['sso']['ssoNotifyAuthentication'] = [
'#type' => 'checkbox',
'#title' => t('Notify user of successful authentication'),
'#description' => t($this->ssoNotifyAuthenticationDescription),
'#default_value' => $this->ssoNotifyAuthentication,
'#disabled' => (bool) (!$this->ssoEnabled),
];
$form['sso']['cookieExpire'] = [
'#type' => 'select',
'#title' => t('Cookie Lifetime'),
'#description' => t($this->cookieExpireDescription),
'#default_value' => $this->cookieExpire,
'#options' => $this->cookieExpirePeriod,
'#disabled' => (bool) (!$this->ssoEnabled),
];
$form['sso']['ldapImplementation'] = [
'#type' => 'select',
'#title' => t('Authentication Mechanism'),
'#description' => t($this->ldapImplementationDescription),
'#default_value' => $this->ldapImplementation,
'#options' => $this->ldapImplementationOptions,
'#disabled' => (bool) (!$this->ssoEnabled),
];
$form['sso']['ssoExcludedPaths'] = [
'#type' => 'textarea',
'#title' => t('SSO Excluded Paths'),
'#description' => t($this->ssoExcludedPathsDescription),
'#default_value' => $this
->arrayToLines($this->ssoExcludedPaths),
'#disabled' => (bool) (!$this->ssoEnabled),
];
$form['sso']['ssoExcludedHosts'] = [
'#type' => 'textarea',
'#title' => t('SSO Excluded Hosts'),
'#description' => t($this->ssoExcludedHostsDescription),
'#default_value' => $this
->arrayToLines($this->ssoExcludedHosts),
'#disabled' => (bool) (!$this->ssoEnabled),
];
$form['submit'] = [
'#type' => 'submit',
'#value' => 'Save',
];
return $form;
}