Update the user.

PUT (:orchestra)/users/$user

@param  \Orchestra\Foundation\Processors\User  $processor
@param  int|string  $user

@return mixed
326083
public function update(Processor $processor, $user)
    {
        return $processor->update($this, $user, Input::all());
    }
430438
private function createEditForm(User $user)
    {
        $form = $this->createForm(new UserType(), $user, array(
            'action' => $this->generateUrl('admin_user_update', array('id' => $user->getId())),
            'method' => 'PUT',
        ));

        $form->add('submit', 'submit', array('label' => 'Update'));

        return $form;
    }
1363794
public function addUser(ServerUser $user)
    {
        if ($this->users->contains($user) === false) {
            $user->setServer($this);
            $this->users->add($user);
        }

        return $this;
    }
286375
public function updateUser(User $user)
    {
        $this->find("id", $user->id);
        $this->setUserData($user);
        $this->save();
    }
789998
public function update(Customer &$customer)
    {
        $data = $customer->exportData();
        $endpoint = '/admin/customers/'.$customer->id.'.json';
        $response = $this->request(
            $endpoint, 'PUT', array(
            'customer' => $data
            )
        );
        $customer->setData($response['customer']);
    }
726068
public void updateUser(User user){
        ProtocolHeader header = new ProtocolHeader();
        header.setType(ProtocolType.UpdateUser);

        UpdateUserProtocol p = new UpdateUserProtocol(user);

        connection.submitRequest(header, p, null);
    }
458717
public function update(UpdateUserRequest $request, User $user)
    {
        $this->authorize(UsersPolicy::PERMISSION_UPDATE);

        $user->update($request->getValidatedData());
        $user->roles()->sync($request->get('roles'));

        $this->transNotification('updated', ['name' => $user->full_name], $user->toArray());

        return redirect()->route('admin::auth.users.show', [$user->hashed_id]);
    }
695985
protected function editor(User $user)
    {
        // store props
        $oldProps = new UserUpdater($user);
        $newProps = $this->getNewValues($user);

        // confirm
        $ln = <<<EOL
Summary
-------
Username: "{$newProps->getUsername()}"
Email:    "{$newProps->getEmail()}"
Password: "{$newProps->getPassword()}"
EOL;
        $this->logger->block($ln);

        // check changes
        $changedValues = $oldProps->getChanged($newProps);
        if (empty($changedValues)) {
            $this->logger->note('Nothing changed, exiting.');

            return;
        }
        // persist
        if ($persist = $this->ask(new ConfirmationQuestion('Confirm user update?'))) {
            $this->userEditor->updateUser($user, $newProps);
            $this->logger->success('User updated!');
        }
        // send mail
        if ($persist) {
            $dontSend = 'Don\'t send';
            $emailChoices = [$dontSend, $oldProps->getEmail()];
            if (isset($changedValues['email'])) {
                $emailChoices[] = $changedValues['email'];
            }
            $to = $this->ask(new ChoiceQuestion('Send notification to', $emailChoices));
            if ($to !== $dontSend) {
                $this->sendNotification($to, $changedValues);
            }
        }
    }
1104635
public function update(Processor $processor, $vendor, $package = null)
    {
        $extension = $this->getExtension($vendor, $package);

        return $processor->update($this, $extension, Input::all());
    }
456597
public function setUser($user)
    {

        // Clear cache
        $this->user = null;

        // Find element
        if (!$user = $this->findUserElement($user)) {
            // Clear property / cache
            $this->userId = $this->user = null;
        } else {
            // Set property
            $this->userId = $user->getId();

            // Set cache
            $this->user = $user;
        }

        return $this;
    }
1135462
public function update(User $user, User $entity)
    {
        if ($entity->id === $user->id) {
            return true;
        }
        return $user->hasPermission('user-update');
    }
1356720
private function updateUserByOAuthUserResponse(UserInterface $user, UserResponseInterface $response): SyliusUserInterface
    {
        /** @var SyliusUserInterface $user */
        Assert::isInstanceOf($user, SyliusUserInterface::class);

        /** @var UserOAuthInterface $oauth */
        $oauth = $this->oauthFactory->createNew();
        $oauth->setIdentifier($response->getUsername());
        $oauth->setProvider($response->getResourceOwner()->getName());
        $oauth->setAccessToken($response->getAccessToken());
        $oauth->setRefreshToken($response->getRefreshToken());

        $user->addOAuthAccount($oauth);

        $this->userManager->persist($user);
        $this->userManager->flush();

        return $user;
    }
188797
public function setUser(\Claroline\CoreBundle\Entity\User $user)
    {
        $this->user = $user;

        return $this;
    }
1344725
public function update(User $user, Request $request)
    {
        // user we want to edit and session user must be the same
        if ($user->id != user()->id) {
            return redirect()
                ->back()
                ->withInput($request->all())
                ->withErrors(['firstname' => 'Unauthorized access']);
        }

        // submit without a file
        if (is_null($request->file('photo'))) {
            $this->validate($request, array_except(User::$rulesProfile, 'photo'));
        }
        else {
            $this->validate($request, User::$rulesProfile);

            $photo = $this->uploadProfilePicture($request->file('photo'));

            $request->merge(['image' => $photo]);
        }

        // update user without photo and password
        $this->updateEntry($user, $request->only([
            'firstname',
            'lastname',
            'cellphone',
            'telephone',
            'born_at',
            'image'
        ]));

        // update user  password
        if ($request['password'] && strlen($request['password']) >= 2) {
            user()->update([
                'password' => bcrypt($request['password']),
            ]);
        }

        return redirect('/admin/profile');
    }
255049
public function updateUser(UserInterface $user)
    {
        $user->setChangedValue();
        $this->em->persist($user);
        $this->em->flush();
        return true;
    }
932935
public function setAtom(User $user, $key, $value)
    {

        $conn = $this->getEntityManager()->getConnection();
        $stmt = $conn->prepare('INSERT INTO users_atoms ( user_id, `key`, `value`) VALUES( ?, ?, ? ) ON DUPLICATE KEY UPDATE `value`=VALUES(`value`)');

        $user_id = $user->getId();
        $stmt->bindParam(1, $user_id);
        $stmt->bindParam(2, $key);
        $stmt->bindParam(3, $value);
        $stmt->execute();
    }
1068672
public function addUser(User $user)
    {
        if (!$this->users->contains($user)) {
            $this->users->add($user);
        }

        return $this;
    }