invalidate account, before reading it, to code with changed to DB or LDAP outside EGw

This commit is contained in:
Ralf Becker 2013-04-23 13:47:20 +00:00
parent a211ea665d
commit 5c71e6916e
3 changed files with 19 additions and 13 deletions

View File

@ -5,9 +5,9 @@
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package admin
* @copyright (c) 2007 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2007-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
* @version $Id$
*/
/**
@ -35,7 +35,7 @@ class admin_cmd_edit_group extends admin_cmd
/**
* change the password of a given user
*
*
* @param boolean $check_only=false only run the checks (and throw the exceptions), but not the command itself
* @return string success message
* @throws egw_exception_no_admin
@ -66,7 +66,7 @@ class admin_cmd_edit_group extends admin_cmd
{
throw new egw_exception_wrong_userinput(lang('You must enter a group name.'),9);
}
if (!is_null($data['account_lid']) && ($id = admin_cmd::$accounts->name2id($data['account_lid'],'account_lid','g')) &&
if (!is_null($data['account_lid']) && ($id = admin_cmd::$accounts->name2id($data['account_lid'],'account_lid','g')) &&
$id !== $data['account_id'])
{
throw new egw_exception_wrong_userinput(lang('That loginid has already been taken'),999);
@ -80,9 +80,11 @@ class admin_cmd_edit_group extends admin_cmd
$data['account_members'] = admin_cmd::parse_accounts($data['account_members'],true);
}
if ($check_only) return true;
if ($this->account)
{
// invalidate account, before reading it, to code with changed to DB or LDAP outside EGw
accounts::cache_invalidate($data['account_id']);
if (!($old = admin_cmd::$accounts->read($data['account_id'])))
{
throw new egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$this->account),15);
@ -102,7 +104,7 @@ class admin_cmd_edit_group extends admin_cmd
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
'location' => $this->account ? 'editgroup' : 'addgroup'
),False,True); // called for every app now, not only enabled ones)
if ($data['account_members'])
{
admin_cmd::$accounts->set_members($data['account_members'],$data['account_id']);

View File

@ -5,7 +5,7 @@
* @link http://www.egroupware.org
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @package admin
* @copyright (c) 2007-10 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @copyright (c) 2007-13 by Ralf Becker <RalfBecker-AT-outdoor-training.de>
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
@ -123,6 +123,8 @@ class admin_cmd_edit_user extends admin_cmd_change_pw
if ($this->account)
{
// invalidate account, before reading it, to code with changed to DB or LDAP outside EGw
accounts::cache_invalidate($data['account_id']);
if (!($old = admin_cmd::$accounts->read($data['account_id'])))
{
throw new egw_exception_wrong_userinput(lang("Unknown account: %1 !!!",$this->account),15);

View File

@ -994,8 +994,9 @@
$t->parse('password_fields','form_logininfo',True);
$account =& CreateObject('phpgwapi.accounts',(int)$_GET['account_id'],'u');
$userData = $account->read_repository();
// invalidate account, before reading it, to code with changed to DB or LDAP outside EGw
accounts::cache_invalidate((int)$_GET['account_id']);
$userData = $GLOBALS['egw']->accounts->read((int)$_GET['account_id'],'u');
$var['account_lid'] = $userData['account_lid'];
$var['account_firstname'] = $userData['firstname'];
@ -1053,7 +1054,7 @@
}
// Find out which groups they are members of
$usergroups = $account->membership((int)$_GET['account_id']);
$usergroups = $GLOBALS['egw']->accounts->membership((int)$_GET['account_id']);
if(!@is_array($usergroups))
{
$var['groups_select'] = lang('None');
@ -1174,8 +1175,10 @@
$p->set_file(Array('edit' => 'group_form.tpl'));
$p->set_block('edit','select');
$p->set_block('edit','popwin');
//fix from Maanus 280105
$accounts =& CreateObject('phpgwapi.accounts',$group_info['account_id'],'g');
// invalidate account, before reading it, to code with changed to DB or LDAP outside EGw
accounts::cache_invalidate((int)$_GET['account_id']);
$group_repository = $GLOBALS['egw']->accounts->read((int)$_GET['account_id'],'u');
$p->set_var('accounts',$GLOBALS['egw']->uiaccountsel->selection('account_user[]','admin_uiaccounts_user',$group_info['account_user'],'accounts',min(3+count($group_info['account_user']),10),false,'style="width: 300px;"'));
@ -1190,7 +1193,6 @@
);
$p->set_var($var);
$group_repository = $accounts->read_repository();
if (!$group_repository['file_space'])
{
$group_repository['file_space'] = $GLOBALS['egw_info']['server']['vfs_default_account_size_number'] . "-" . $GLOBALS['egw_info']['server']['vfs_default_account_size_type'];