From 5c71e6916ea234c45fba819ef546e08692a0de63 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 23 Apr 2013 13:47:20 +0000 Subject: [PATCH] invalidate account, before reading it, to code with changed to DB or LDAP outside EGw --- admin/inc/class.admin_cmd_edit_group.inc.php | 14 ++++++++------ admin/inc/class.admin_cmd_edit_user.inc.php | 4 +++- admin/inc/class.uiaccounts.inc.php | 14 ++++++++------ 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/admin/inc/class.admin_cmd_edit_group.inc.php b/admin/inc/class.admin_cmd_edit_group.inc.php index e63cff5c7e..50542a2985 100644 --- a/admin/inc/class.admin_cmd_edit_group.inc.php +++ b/admin/inc/class.admin_cmd_edit_group.inc.php @@ -5,9 +5,9 @@ * @link http://www.egroupware.org * @author Ralf Becker * @package admin - * @copyright (c) 2007 by Ralf Becker + * @copyright (c) 2007-13 by Ralf Becker * @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']); diff --git a/admin/inc/class.admin_cmd_edit_user.inc.php b/admin/inc/class.admin_cmd_edit_user.inc.php index 31cd3562a6..e7c75dd081 100644 --- a/admin/inc/class.admin_cmd_edit_user.inc.php +++ b/admin/inc/class.admin_cmd_edit_user.inc.php @@ -5,7 +5,7 @@ * @link http://www.egroupware.org * @author Ralf Becker * @package admin - * @copyright (c) 2007-10 by Ralf Becker + * @copyright (c) 2007-13 by Ralf Becker * @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); diff --git a/admin/inc/class.uiaccounts.inc.php b/admin/inc/class.uiaccounts.inc.php index b0cb6f046d..75059b22dc 100755 --- a/admin/inc/class.uiaccounts.inc.php +++ b/admin/inc/class.uiaccounts.inc.php @@ -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'];