$REMOVE_ARR = array(); parse_str($display_tabs_def, $DISPLAY_ARR); parse_str($hide_tabs_def, $HIDE_ARR); parse_str($remove_tabs_def, $REMOVE_ARR); if (isset($_POST['id'])) { sugar_die("Unauthorized access to administration."); } if (isset($_POST['record']) && !is_admin($current_user) && !$GLOBALS['current_user']->isAdminForModule('Users') && $_POST['record'] != $current_user->id) { sugar_die("Unauthorized access to administration."); } elseif (!isset($_POST['record']) && !is_admin($current_user) && !$GLOBALS['current_user']->isAdminForModule('Users')) { sugar_die("Unauthorized access to user administration."); } $focus = new User(); $focus->retrieve($_POST['record']); //update any ETag seeds that are tied to the user object changing $focus->incrementETag("mainMenuETag"); // Flag to determine whether to save a new password or not. // Bug 43241 - Changed $focus->id to $focus->user_name to make sure that a system generated password is made when converting employee to user if (empty($focus->user_name)) { $newUser = true; clear_register_value('user_array', $focus->object_name); } else { $newUser = false; } if (!$current_user->is_admin && !$GLOBALS['current_user']->isAdminForModule('Users')) { if ($current_user->id != $focus->id || !empty($_POST['is_admin']) || !empty($_POST['UserType']) && $_POST['UserType'] == 'Administrator') { $GLOBALS['log']->fatal("SECURITY:Non-Admin " . $current_user->id . " attempted to change settings for user:"******"Location: index.php?module=Users&action=Logout"); exit; } }
public function testGetETagSeedAndIncrementETag() { //unset and reconnect Db to resolve mysqli fetch exeception global $db; unset($db->database); $db->checkConnection(); $user = new User(); $user->retrieve(1); //execute getETagSeed method, get Etag value $ETagInitial = $user->getETagSeed('test'); $this->assertGreaterThanOrEqual(0, $ETagInitial); //execute incrementETag to increment $user->incrementETag('test'); //execute getETagSeed method again, get Etag final value and compare final and initial values $ETagFinal = $user->getETagSeed('test'); $this->assertGreaterThan($ETagInitial, $ETagFinal); }