* Switch on password migration to migrate to new default ssha, if installation uses the old default

- altering egw_categories.cat_owner to varchar(255) to prepare for multiple category owners/groups
This commit is contained in:
Ralf Becker 2011-05-07 18:46:29 +00:00
parent f00ba4dc9a
commit 13b4bb3e75
3 changed files with 57 additions and 5 deletions

View File

@ -11,14 +11,14 @@
/* Basic information about this app */
$setup_info['phpgwapi']['name'] = 'phpgwapi';
$setup_info['phpgwapi']['title'] = 'eGroupWare API';
$setup_info['phpgwapi']['version'] = '1.9.008';
$setup_info['phpgwapi']['title'] = 'EGroupware API';
$setup_info['phpgwapi']['version'] = '1.9.009';
$setup_info['phpgwapi']['versions']['current_header'] = '1.29';
$setup_info['phpgwapi']['enable'] = 3;
$setup_info['phpgwapi']['app_order'] = 1;
$setup_info['phpgwapi']['license'] = 'GPL';
$setup_info['phpgwapi']['maintainer'] = $setup_info['phpgwapi']['author'] = array(
'name' => 'eGroupWare coreteam',
'name' => 'EGroupware coreteam',
'email' => 'egroupware-developers@lists.sourceforge.net',
);
@ -74,4 +74,3 @@ $setup_info['groupdav']['author'] = $setup_info['groupdav']['maintainer'] = arra
$setup_info['groupdav']['license'] = 'GPL';
$setup_info['groupdav']['hooks']['preferences'] = 'groupdav_hooks::menus';
$setup_info['groupdav']['hooks']['settings'] = 'groupdav_hooks::settings';

View File

@ -149,7 +149,7 @@ $phpgw_baseline = array(
'cat_main' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'cat_parent' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'cat_level' => array('type' => 'int','precision' => '2','nullable' => False,'default' => '0'),
'cat_owner' => array('type' => 'int','precision' => '4','nullable' => False,'default' => '0'),
'cat_owner' => array('type' => 'varchar','precision' => '255','nullable' => False,'default' => '0'),
'cat_access' => array('type' => 'varchar','precision' => '7'),
'cat_appname' => array('type' => 'varchar','precision' => '50','nullable' => False),
'cat_name' => array('type' => 'varchar','precision' => '150','nullable' => False),

View File

@ -203,3 +203,56 @@ function phpgwapi_upgrade1_9_007()
return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.008';
}
/**
* Alter column cat_owner to varchar(255) to support multiple owners/groups per cat
*
* Enable password migration to new default ssha, if current hash is the default (sql: md5, ldap:des)
*/
function phpgwapi_upgrade1_9_008()
{
$GLOBALS['egw_setup']->oProc->AlterColumn('egw_categories','cat_owner',array(
'type' => 'varchar',
'precision' => '255',
'nullable' => False,
'default' => '0'
));
// query password hashing from database
$config = array(
'auth_type' => 'sql',
'account_repository' => null, // default is auth_type
'sql_encryption_type' => 'md5',
'ldap_encryption_type' => 'des',
'pwd_migration_allowed' => null, // default off
);
foreach($GLOBALS['egw_setup']->db->select('egw_config','config_name,config_value',array(
'config_app' => 'phpgwapi',
'config_name' => array_keys($config),
),__LINE__,__FILE__) as $row)
{
$config[$row['config_name']] = $row['config_value'];
}
if (!isset($config['account_repository'])) $config['account_repository'] = $config['auth_type'];
// changing pw hashing only, if we auth agains our own account repository and no migration already active
if ($config['auth_type'] == $config['account_repository'] && !$config['pwd_migration_allowed'])
{
if ($config['auth_type'] == 'sql' && $config['sql_encryption_type'] == 'md5' ||
$config['auth_type'] == 'ldap'&& $config['ldap_encryption_type'] == 'des')
{
$config['sql_encryption_type'] = $config['ldap_encryption_type'] = 'ssha';
$config['pwd_migration_allowed'] = 'True';
$config['pwd_migration_types'] = 'md5,crypt'; // des is called crypt in hash
}
foreach($config as $name => $value)
{
$GLOBALS['egw_setup']->db->insert('egw_config',array(
'config_value' => $value,
),array(
'config_app' => 'phpgwapi',
'config_name' => $name,
),__LINE__,__FILE__);
}
}
return $GLOBALS['setup_info']['phpgwapi']['currentver'] = '1.9.009';
}