/** * Update existing operator account * * @param string $id Login name of account to update * @param string[] $data List of properties to set. Unknown keys will be ignored. * @param string $password New password. If empty, password will remain unchanged. */ public function update($id, $data, $password) { // Compose array of columns to set $update = @$this->_operators->getHydrator()->extract(new \ArrayObject($data)); unset($update['']); // caused by unrecognized key, ignore // Set password if specified if ($password) { $update['passwd'] = md5($password); } if (!$this->_operators->update($update, array('id' => $id))) { throw new \RuntimeException('Invalid user name: ' . $id); } if (isset($data['Id']) and $id == $this->_authenticationService->getIdentity()) { // If the account name of the logged in user is changed, the // identity must be updated to remain valid. $this->_authenticationService->changeIdentity($data['Id']); } }
public function testChangeIdentityNoIdentity() { $this->setExpectedException('InvalidArgumentException', 'No identity provided'); $this->_auth->changeIdentity(''); }