mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
migrate AD accounts incl. mail-attributes to SQL
This commit is contained in:
parent
6baad3bee1
commit
b29f89cf16
@ -1244,7 +1244,7 @@ class Ads
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fixes an enhancements for adLDAP required by EGroupware
|
* Fixes and enhancements for adLDAP required by EGroupware
|
||||||
*
|
*
|
||||||
* - allow to use utf-8 charset internally, not just an 8-bit iso-charset
|
* - allow to use utf-8 charset internally, not just an 8-bit iso-charset
|
||||||
* - support for Windows2008r2 (maybe earlier too) and Samba4 "CN=Users" DN as container to create users or groups
|
* - support for Windows2008r2 (maybe earlier too) and Samba4 "CN=Users" DN as container to create users or groups
|
||||||
|
@ -1,14 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* EGroupware Setup - Account migration between SQL <--> LDAP
|
* EGroupware Setup - Account migration between SQL <--> LDAP (incl. AD and Univention)
|
||||||
*
|
*
|
||||||
* The migration is done to the account-repository configured for EGroupware!
|
* The migration is done from the account-repository configured for EGroupware!
|
||||||
*
|
*
|
||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @package setup
|
* @package setup
|
||||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use EGroupware\Api;
|
use EGroupware\Api;
|
||||||
|
@ -5,9 +5,8 @@
|
|||||||
* @link http://www.egroupware.org
|
* @link http://www.egroupware.org
|
||||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @package setup
|
* @package setup
|
||||||
* @copyright (c) 2007-16 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
* @copyright (c) 2007-18 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @version $Id$
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
use EGroupware\Api;
|
use EGroupware\Api;
|
||||||
@ -454,6 +453,7 @@ class setup_cmd_ldap extends setup_cmd
|
|||||||
{
|
{
|
||||||
$GLOBALS['egw']->db->query('TRUNCATE TABLE egw_accounts', __LINE__, __FILE__);
|
$GLOBALS['egw']->db->query('TRUNCATE TABLE egw_accounts', __LINE__, __FILE__);
|
||||||
$GLOBALS['egw']->db->query('DELETE FROM egw_addressbook WHERE account_id IS NOT NULL', __LINE__, __FILE__);
|
$GLOBALS['egw']->db->query('DELETE FROM egw_addressbook WHERE account_id IS NOT NULL', __LINE__, __FILE__);
|
||||||
|
$GLOBALS['egw']->db->query('TRUNCATE TABLE egw_mailaccounts', __LINE__, __FILE__);
|
||||||
}
|
}
|
||||||
// instanciate accounts obj for new store
|
// instanciate accounts obj for new store
|
||||||
$accounts_obj = $this->accounts_obj($to);
|
$accounts_obj = $this->accounts_obj($to);
|
||||||
@ -524,9 +524,12 @@ class setup_cmd_ldap extends setup_cmd
|
|||||||
$account['homedirectory'] = $GLOBALS['egw_info']['server']['ldap_account_home'] . '/' . $account['account_lid'];
|
$account['homedirectory'] = $GLOBALS['egw_info']['server']['ldap_account_home'] . '/' . $account['account_lid'];
|
||||||
$account['loginshell'] = $GLOBALS['egw_info']['server']['ldap_account_shell'];
|
$account['loginshell'] = $GLOBALS['egw_info']['server']['ldap_account_shell'];
|
||||||
}
|
}
|
||||||
$account['account_passwd'] = self::hash_sql2ldap($account['account_pwd']);
|
if (!empty($account['account_pwd']))
|
||||||
|
{
|
||||||
|
$account['account_passwd'] = self::hash_sql2ldap($account['account_pwd']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
elseif (!empty($account['account_pwd']))
|
||||||
{
|
{
|
||||||
$account['account_passwd'] = self::hash_ldap2sql($account['account_pwd']);
|
$account['account_passwd'] = self::hash_ldap2sql($account['account_pwd']);
|
||||||
}
|
}
|
||||||
@ -543,13 +546,18 @@ class setup_cmd_ldap extends setup_cmd
|
|||||||
$accounts_created++;
|
$accounts_created++;
|
||||||
|
|
||||||
// check if we need to migrate mail-account
|
// check if we need to migrate mail-account
|
||||||
if (!isset($ldap_class) && $this->account_repository !== 'ads')
|
if ($this->account_repository === 'ads')
|
||||||
|
{
|
||||||
|
$ldap_class = 'EGroupware\\Api\\Mail\\Smtp\\Ads';
|
||||||
|
}
|
||||||
|
elseif (!isset($ldap_class))
|
||||||
{
|
{
|
||||||
$ldap_class = false;
|
$ldap_class = false;
|
||||||
$ldap = Api\Ldap::factory(false);
|
$ldap = Api\Ldap::factory(false);
|
||||||
foreach(array( // todo: have these enumerated by emailadmin ...
|
foreach(array( // todo: have these enumerated by emailadmin ...
|
||||||
'qmailUser' => 'EGroupware\\Api\\Mail\\Smtp\\Oldqmailuser',
|
'qmailUser' => 'EGroupware\\Api\\Mail\\Smtp\\Oldqmailuser',
|
||||||
'dbMailUser' => 'EGroupware\\Api\\Mail\\Smtp\\Dbmailuser',
|
'dbMailUser' => 'EGroupware\\Api\\Mail\\Smtp\\Dbmailuser',
|
||||||
|
'univentionMail' => 'EGroupware\\Api\\Mail\\Smtp\\Univention',
|
||||||
// nothing to migrate for inetOrgPerson ...
|
// nothing to migrate for inetOrgPerson ...
|
||||||
) as $object_class => $class)
|
) as $object_class => $class)
|
||||||
{
|
{
|
||||||
@ -583,7 +591,7 @@ class setup_cmd_ldap extends setup_cmd
|
|||||||
$mailaccount['accountStatus'], $mailaccount['mailLocalAddress'],
|
$mailaccount['accountStatus'], $mailaccount['mailLocalAddress'],
|
||||||
$mailaccount['quotaLimit'], false, $mailaccount['mailMessageStore']);
|
$mailaccount['quotaLimit'], false, $mailaccount['mailMessageStore']);
|
||||||
|
|
||||||
$msg[] = lang("Mail account of %1 migraged", $account['account_lid']);
|
$msg[] = lang("Mail account of %1 migrated", $account['account_lid']);
|
||||||
}
|
}
|
||||||
//else echo "<p>No mail account data found for #$account_id $account[account_lid]!</p>\n";
|
//else echo "<p>No mail account data found for #$account_id $account[account_lid]!</p>\n";
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user