summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/ldap/ldap_authentication/ldap_authentication.install
blob: 23e0fcf10fd57b0fbd15889187ceeca4f252e8ba (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
// $Id: ldap_authentication.install,v 1.1.4.2 2011/02/08 06:01:00 johnbarclay Exp $

/**
 * @file
 * Install, update and uninstall functions for the LDAP authentication module.
 */


/**
 * Implements hook_requirements().
 */
function ldap_authentication_requirements($phase) {
  $requirements = array();
  if ($phase != "install" && db_table_exists('ldapauth')) {

    $requirements['ldap_authentication_ldap_integration']['title'] = t('LDAP Integration LDAP Auth Upgrade Concern');
    $requirements['ldap_authentication_ldap_integration']['severity'] = REQUIREMENT_WARNING;
    $requirements['ldap_authentication_ldap_integration']['value'] = NULL;
    $requirements['ldap_authentication_ldap_integration']['description'] = t('Upgrade from Drupal 6 LDAP Auth to Drupal 7
      LDAP Authentication is not automatic.  LDAP Authentication will need to be configured by hand.
      Some harmless data will remain in the user.data field in the user table.  Records in
      the authmap table will cause conflicts and should be removed or changed to ldap_authentication
      as the module (see http://drupal.org/node/1183192).
      See http://drupal.org/node/1023016, http://drupal.org/node/1183192.
      This message will go away when the ldapauth database table is removed.');
  }
  // check that ldapauth not installed.
  return $requirements;
}

/**
 * Implements hook_install().
 */
function ldap_authentication_install() {
}

/**
 * Implements hook_uninstall().
 */
function ldap_authentication_uninstall() {
  //$result = db_query('DELETE FROM {variables} WHERE name like "ldap_authentication_%"');
  variable_del('ldap_authentication_conf');
}

/**
 * just notes and psuedo code for now.  need a place to keep track
 * of what a cross grade function would do
 */


/**
 * ldap_authentication and ldap_sso.  enable ldap_sso if sso was enabled in ldap_authentication previously
 */
function ldap_authentication_update_7100() {
  // if sso is enabled in ldap authentication, enable module ldap_sso
	module_load_include('inc', 'ldap_servers','ldap_servers.functions');
  ldap_server_module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConfAdmin.class');
  $sso_enabled = LdapAuthenticationConfAdmin::getSaveableProperty('ssoEnabled');
  if ($sso_enabled) {
    module_enable(array('ldap_sso'));
    return t('Enabled new LDAP SSO module if Single Sign on was previously enabled.  Code for LDAP Single Sign On was moved to new "LDAP SSO" included module.');
  }
}


function ldap_authentication_ldap_integration6_to_ldap7() {

 // fix authmaps
 // UPDATE {authmap} SET module = 'ldap_authentication' WHERE module = 'ldapauth'

 // load all users and setup user data array

/**
 * CREATE TABLE `ldapauth` (
	`sid` TINYINT(4) NOT NULL AUTO_INCREMENT,
	`name` VARCHAR(255) NOT NULL,
	`status` TINYINT(4) NOT NULL DEFAULT '0',
	`server` VARCHAR(255) NOT NULL,
	`port` INT(11) NOT NULL DEFAULT '389',
	`tls` TINYINT(4) NOT NULL DEFAULT '0',
	`encrypted` TINYINT(4) NOT NULL DEFAULT '0',
	`basedn` TEXT NULL,
	`user_attr` VARCHAR(255) NULL DEFAULT NULL,
	`mail_attr` VARCHAR(255) NULL DEFAULT NULL,
	`binddn` VARCHAR(255) NULL DEFAULT NULL,
	`bindpw` VARCHAR(255) NULL DEFAULT NULL,
	`login_php` TEXT NULL,
	`filter_php` TEXT NULL,
	`weight` INT(11) NOT NULL DEFAULT '0',
	`ldapgroups_in_dn` TINYINT(4) NOT NULL DEFAULT '0',
	`ldapgroups_dn_attribute` VARCHAR(255) NULL DEFAULT NULL,
	`ldapgroups_attr` VARCHAR(255) NULL DEFAULT NULL,
	`ldapgroups_in_attr` TINYINT(4) NOT NULL DEFAULT '0',
	`ldapgroups_as_entries` TINYINT(4) NOT NULL DEFAULT '0',
	`ldapgroups_entries` TEXT NULL,
	`ldapgroups_entries_attribute` VARCHAR(255) NULL DEFAULT NULL,
	`ldapgroups_mappings` TEXT NULL,
	`ldapgroups_mappings_filter` TINYINT(4) NOT NULL DEFAULT '0',
	`ldapgroups_filter_php` TEXT NULL,
	`ldapgroups_groups` TEXT NULL,
	PRIMARY KEY (`name`),
	INDEX `sid` (`sid`)
)
COLLATE='utf8_general_ci'
ENGINE=InnoDB
ROW_FORMAT=DEFAULT
AUTO_INCREMENT=2
 */
}