summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/ldap/ldap_authentication/ldap_authentication.admin.inc
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.15/sites/all/modules/ldap/ldap_authentication/ldap_authentication.admin.inc')
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/ldap/ldap_authentication/ldap_authentication.admin.inc62
1 files changed, 62 insertions, 0 deletions
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/ldap/ldap_authentication/ldap_authentication.admin.inc b/kolab.org/www/drupal-7.15/sites/all/modules/ldap/ldap_authentication/ldap_authentication.admin.inc
new file mode 100644
index 0000000..eb60148
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/ldap/ldap_authentication/ldap_authentication.admin.inc
@@ -0,0 +1,62 @@
+<?php
+// $Id: ldap_authentication.admin.inc,v 1.1.4.2 2011/02/08 06:01:00 johnbarclay Exp $
+
+/**
+ * @file
+ * Administrative page callbacks for the ldap_authentication module.
+ */
+
+
+/**
+ * form for adding, updating, and deleting a single ldap authorization mapping
+ *
+ * @param <type> $form
+ * @param <type> $form_state
+ * @return array drupal form array
+ */
+function ldap_authentication_admin_form($form, &$form_state) {
+ ldap_server_module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConfAdmin.class');
+ $auth_conf = new LdapAuthenticationConfAdmin();
+ return $auth_conf->drupalForm();
+}
+
+
+/**
+ * validate handler for the ldap_authentication_admin_form
+ */
+function ldap_authentication_admin_form_validate($form, &$form_state) {
+
+ ldap_server_module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConfAdmin.class');
+ $auth_conf = new LdapAuthenticationConfAdmin();
+ $errors = $auth_conf->drupalFormValidate($form_state['values']);
+ foreach ($errors as $error_name => $error_text) {
+ form_set_error($error_name, t($error_text));
+ }
+
+}
+
+
+/**
+ * submit handler function for ldap_authorization_admin_form
+ */
+
+function ldap_authentication_admin_form_submit($form, &$form_state) {
+ ldap_server_module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConfAdmin.class');
+ $auth_conf = new LdapAuthenticationConfAdmin();
+ $auth_conf->drupalFormSubmit($form_state['values']); // add form data to object and save or create
+
+ if (!$auth_conf->enabled_servers()) {
+ drupal_set_message(t('No LDAP servers are enabled for authentication,
+ so no LDAP Authentication can take place. This essentially disables
+ LDAP Authentication.'), 'warning');
+ }
+ if ($auth_conf->hasError == FALSE) {
+ drupal_set_message(t('LDAP Authentication configuration saved'), 'status');
+ drupal_goto(LDAP_SERVERS_MENU_BASE_PATH . '/authentication');
+ }
+ else {
+ form_set_error($auth_conf->errorName, $auth_conf->errorMsg);
+ $auth_conf->clearError();
+ }
+
+}