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