fixed critical bug:

a too long account-lid caused the complete lost of run-rigths from all user and groups
This commit is contained in:
Ralf Becker 2006-04-30 12:18:47 +00:00
parent 6d6ec22c18
commit c71c53851f
3 changed files with 13 additions and 11 deletions

View File

@ -27,10 +27,10 @@
$userData['account_email'] = $userData['email']; $userData['account_email'] = $userData['email'];
} }
$GLOBALS['egw']->accounts->create($userData); if (!($userData['account_id'] = $GLOBALS['egw']->accounts->create($userData)))
{
$userData['account_id'] = $GLOBALS['egw']->accounts->name2id($userData['account_lid']); return false;
}
$apps =& CreateObject('phpgwapi.applications',$userData['account_id']); $apps =& CreateObject('phpgwapi.applications',$userData['account_id']);
$apps->read_installed_apps(); $apps->read_installed_apps();
// Read Group Apps // Read Group Apps

View File

@ -1063,7 +1063,7 @@
$theme = $GLOBALS['egw_info']['user']['preferences']['common']['theme']; $theme = $GLOBALS['egw_info']['user']['preferences']['common']['theme'];
$t->set_var('icon_create_edit', '<img src="'. $GLOBALS['egw_info']['server']['webserver_url'] .'/admin/templates/'.$theme.'/images/useradm.gif">'); $t->set_var('icon_create_edit', '<img src="'. $GLOBALS['egw_info']['server']['webserver_url'] .'/admin/templates/'.$theme.'/images/useradm.gif">');
print_debug('Type : '.gettype($_userData).'<br>_userData(size) = "'.$_userData.'"('.strlen($_userData).')'); //print_debug('Type : '.gettype($_userData).'<br>_userData(size) = "'.$_userData.'"('.strlen($_userData).')');
if (is_array($_userData)) if (is_array($_userData))
{ {
$userData = Array(); $userData = Array();
@ -1190,7 +1190,7 @@
$var = Array( $var = Array(
'input_expires' => $jscal->input('expires',$userData['expires']<0?'':($userData['expires']?$userData['expires']:time()+(60*60*24*7))), 'input_expires' => $jscal->input('expires',$userData['expires']<0?'':($userData['expires']?$userData['expires']:time()+(60*60*24*7))),
'lang_never' => lang('Never'), 'lang_never' => lang('Never'),
'account_lid' => $accountPrefix.'<input id="account" onchange="check_account_email(this.id);" name="account_lid" value="' . $userData['account_lid'] . '">', 'account_lid' => $accountPrefix.'<input id="account" onchange="check_account_email(this.id);" name="account_lid" maxlength="64" value="' . $userData['account_lid'] . '">',
'lang_homedir' => $lang_homedir, 'lang_homedir' => $lang_homedir,
'lang_shell' => $lang_shell, 'lang_shell' => $lang_shell,
'homedirectory' => $homedirectory, 'homedirectory' => $homedirectory,
@ -1198,9 +1198,9 @@
'anonymous' => '<input type="checkbox" name="anonymous" value="1"'.($userData['anonymous'] ? ' checked' : '').'>', 'anonymous' => '<input type="checkbox" name="anonymous" value="1"'.($userData['anonymous'] ? ' checked' : '').'>',
'changepassword' => '<input type="checkbox" name="changepassword" value="1"'.($userData['changepassword'] ? ' checked' : '').'>', 'changepassword' => '<input type="checkbox" name="changepassword" value="1"'.($userData['changepassword'] ? ' checked' : '').'>',
'account_status' => '<input type="checkbox" name="account_status" value="A"'.($userData['status']?' checked':'').'>', 'account_status' => '<input type="checkbox" name="account_status" value="A"'.($userData['status']?' checked':'').'>',
'account_firstname' => '<input id="firstname" onchange="check_account_email(this.id);" name="account_firstname" value="' . $userData['firstname'] . '">', 'account_firstname' => '<input id="firstname" onchange="check_account_email(this.id);" name="account_firstname" maxlength="50" value="' . $userData['firstname'] . '">',
'account_lastname' => '<input id="lastname" onchange="check_account_email(this.id);" name="account_lastname" value="' . $userData['lastname'] . '">', 'account_lastname' => '<input id="lastname" onchange="check_account_email(this.id);" name="account_lastname" maxlength="50" value="' . $userData['lastname'] . '">',
'account_email' => '<input id="email" onchange="check_account_email(this.id);" name="account_email" size="32" value="' . $userData['email'] . '">', 'account_email' => '<input id="email" onchange="check_account_email(this.id);" name="account_email" size="32" maxlength="100" value="' . $userData['email'] . '">',
'account_passwd' => $userData['account_passwd'], 'account_passwd' => $userData['account_passwd'],
'account_passwd_2' => $userData['account_passwd_2'], 'account_passwd_2' => $userData['account_passwd_2'],
'account_file_space' => $account_file_space, 'account_file_space' => $account_file_space,

View File

@ -313,8 +313,10 @@
// only use account_id, if it's not already used // only use account_id, if it's not already used
$account_data['account_id'] = abs($account_info['account_id']); $account_data['account_id'] = abs($account_info['account_id']);
} }
$this->db->insert($this->table,$account_data,False,__LINE__,__FILE__); if (!$this->db->insert($this->table,$account_data,False,__LINE__,__FILE__))
{
return false;
}
$id = $account_data['account_id'] ? $account_data['account_id'] : $this->db->get_last_insert_id($this->table,'account_id'); $id = $account_data['account_id'] ? $account_data['account_id'] : $this->db->get_last_insert_id($this->table,'account_id');
if ($account_info['account_type'] == 'g' && $id > 0) // create negative id for groups if ($account_info['account_type'] == 'g' && $id > 0) // create negative id for groups