1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Install, update and uninstall functions for the LDAP authentication module.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Implements hook_requirements().
|
10
|
*/
|
11
|
function ldap_authentication_requirements($phase) {
|
12
|
|
13
|
$requirements = array();
|
14
|
if ($phase != "install" && db_table_exists('ldapauth')) {
|
15
|
$requirements['ldap_authentication_ldap_integration']['title'] = t('LDAP Integration LDAP Auth Upgrade Concern');
|
16
|
$requirements['ldap_authentication_ldap_integration']['severity'] = REQUIREMENT_WARNING;
|
17
|
$requirements['ldap_authentication_ldap_integration']['value'] = NULL;
|
18
|
$requirements['ldap_authentication_ldap_integration']['description'] = t('Upgrade from Drupal 6 LDAP Auth to Drupal 7
|
19
|
LDAP Authentication is not automatic. LDAP Authentication will need to be configured by hand.
|
20
|
Some harmless data will remain in the user.data field in the user table. Records in
|
21
|
the authmap table will cause conflicts and should be removed or changed to ldap_authentication
|
22
|
as the module (see http://drupal.org/node/1183192).
|
23
|
See http://drupal.org/node/1023016, http://drupal.org/node/1183192.
|
24
|
This message will go away when the ldapauth database table is removed.');
|
25
|
}
|
26
|
return $requirements;
|
27
|
}
|
28
|
|
29
|
/**
|
30
|
* Implements hook_install().
|
31
|
*/
|
32
|
function ldap_authentication_install() {
|
33
|
}
|
34
|
|
35
|
/**
|
36
|
* Implements hook_uninstall().
|
37
|
*/
|
38
|
function ldap_authentication_uninstall() {
|
39
|
variable_del('ldap_authentication_conf');
|
40
|
}
|
41
|
|
42
|
/**
|
43
|
* ldap_authentication and ldap_sso. enable ldap_sso if sso was enabled in ldap_authentication previously
|
44
|
*/
|
45
|
function ldap_authentication_update_7100() {
|
46
|
// if sso is enabled in ldap authentication, enable module ldap_sso
|
47
|
module_load_include('inc', 'ldap_servers', 'ldap_servers.functions');
|
48
|
ldap_servers_module_load_include('php', 'ldap_authentication', 'LdapAuthenticationConfAdmin.class');
|
49
|
$sso_enabled = LdapAuthenticationConfAdmin::getSaveableProperty('ssoEnabled');
|
50
|
if ($sso_enabled) {
|
51
|
module_enable(array('ldap_sso'));
|
52
|
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.');
|
53
|
}
|
54
|
}
|
55
|
|
56
|
|
57
|
function ldap_authentication_ldap_integration6_to_ldap7() {
|
58
|
|
59
|
// fix authmaps
|
60
|
// UPDATE {authmap} SET module = 'ldap_authentication' WHERE module = 'ldapauth'
|
61
|
|
62
|
// load all users and setup user data array
|
63
|
|
64
|
/**
|
65
|
* CREATE TABLE `ldapauth` (
|
66
|
`sid` TINYINT(4) NOT NULL AUTO_INCREMENT,
|
67
|
`name` VARCHAR(255) NOT NULL,
|
68
|
`status` TINYINT(4) NOT NULL DEFAULT '0',
|
69
|
`server` VARCHAR(255) NOT NULL,
|
70
|
`port` INT(11) NOT NULL DEFAULT '389',
|
71
|
`tls` TINYINT(4) NOT NULL DEFAULT '0',
|
72
|
`encrypted` TINYINT(4) NOT NULL DEFAULT '0',
|
73
|
`basedn` TEXT NULL,
|
74
|
`user_attr` VARCHAR(255) NULL DEFAULT NULL,
|
75
|
`mail_attr` VARCHAR(255) NULL DEFAULT NULL,
|
76
|
`binddn` VARCHAR(255) NULL DEFAULT NULL,
|
77
|
`bindpw` VARCHAR(255) NULL DEFAULT NULL,
|
78
|
`login_php` TEXT NULL,
|
79
|
`filter_php` TEXT NULL,
|
80
|
`weight` INT(11) NOT NULL DEFAULT '0',
|
81
|
`ldapgroups_in_dn` TINYINT(4) NOT NULL DEFAULT '0',
|
82
|
`ldapgroups_dn_attribute` VARCHAR(255) NULL DEFAULT NULL,
|
83
|
`ldapgroups_attr` VARCHAR(255) NULL DEFAULT NULL,
|
84
|
`ldapgroups_in_attr` TINYINT(4) NOT NULL DEFAULT '0',
|
85
|
`ldapgroups_as_entries` TINYINT(4) NOT NULL DEFAULT '0',
|
86
|
`ldapgroups_entries` TEXT NULL,
|
87
|
`ldapgroups_entries_attribute` VARCHAR(255) NULL DEFAULT NULL,
|
88
|
`ldapgroups_mappings` TEXT NULL,
|
89
|
`ldapgroups_mappings_filter` TINYINT(4) NOT NULL DEFAULT '0',
|
90
|
`ldapgroups_filter_php` TEXT NULL,
|
91
|
`ldapgroups_groups` TEXT NULL,
|
92
|
PRIMARY KEY (`name`),
|
93
|
INDEX `sid` (`sid`)
|
94
|
)
|
95
|
COLLATE='utf8_general_ci'
|
96
|
ENGINE=InnoDB
|
97
|
ROW_FORMAT=DEFAULT
|
98
|
AUTO_INCREMENT=2
|
99
|
*/
|
100
|
}
|