Update user.

@param userEntity
the user entity
@return the response
332025
public Response updateUser(UserEntity userEntity) {
		return restClient.put("users/" + userEntity.getUsername(), userEntity, new HashMap<String, String>());
	}
1142129
public function update($userId, array $data=null)
    {
        $payload = [];
        if( $data !== null ){
            $payload['data'] = $data;
        }
        $response = $this->doRequest('PUT', 'user/' . $userId . '/', $payload);
        $body = $response->getBody()->getContents();
        return json_decode($body, true);
    }
184119
public void updateUser(UserUpdate update) {
		getResourceFactory().getApiResource("/user/")
				.entity(update, MediaType.APPLICATION_JSON_TYPE).put();
	}
715340
def update(self, eid, entity, note=None):
		
		# fetch the current entity
		newentity = self.get(eid)
		for field in ('createdAtDate', 'id', 'isActive', 'parentRevision', 'revisionNr', 'updatedAtDate', 'updatedByUserName','updatedFromIp'):
			if field in newentity: del newentity[field]

		# replace fields as specified in entity
		for field in entity:
			if field=='metadata':
				for mfield in entity['metadata']:
					newentity['metadata'][mfield] = entity['metadata'][mfield]
			else:
				newentity[field] = entity[field]

		result = self.replace(eid,newentity,note=note)
		return result
1026525
public function updateUserToken(UserTokenUpdateStruct $userTokenUpdateStruct)
    {
        try {
            return $this->innerGateway->updateUserToken($userTokenUpdateStruct);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
189532
@PUT
    @Produces(MediaType.APPLICATION_JSON)
    @Consumes(MediaType.APPLICATION_JSON)
    @Path("{userId}/preferences")
    @Description("Update user preferences.")
    public PrincipalUserDto updateUserPreferences(@Context HttpServletRequest req,
        @PathParam("userId") final BigInteger userId, final Map<Preference, String> prefs) {
        if (userId == null || userId.compareTo(BigInteger.ZERO) < 1) {
            throw new WebApplicationException("User Id cannot be null and must be a positive non-zero number.", Status.BAD_REQUEST);
        }
        if (prefs == null) {
            throw new WebApplicationException("Cannot update with null prefs.", Status.BAD_REQUEST);
        }

        PrincipalUser remoteUser = getRemoteUser(req);
        PrincipalUser user = _uService.findUserByPrimaryKey(userId);

        validateResourceAuthorization(req, user, remoteUser);
        if (user == null) {
            throw new WebApplicationException(Response.Status.NOT_FOUND.getReasonPhrase(), Response.Status.NOT_FOUND);
        }
        user.getPreferences().putAll(prefs);
        user = _uService.updateUser(user);
        return PrincipalUserDto.transformToDto(user);
    }
860036
def update(self, user, identity):
        
        return UserIdentityRequest(self).put(self.endpoint.update, user, identity)
98571
protected function createResourceFromUser(UserEntity $user)
    {
        $resource = new Resource(
            $this->generateReadUrl($user->getUsernameCanonical()),
            array(
                 'username'   => $user->getUsernameCanonical(),
                 'email'      => $user->getEmail(),
                 'last_login' => $user->getLastLogin() ? $user->getLastLogin()->format('c') : null,
            )
        );

        return $resource;
    }
418030
protected void saveRememberMeKeyToCookie(USER_ENTITY userEntity, USER_BEAN userBean) {
        final int expireDays = getRememberMeAccessTokenExpireDays();
        getCookieRememberMeKey().ifPresent(cookieKey -> {
            doSaveRememberMeCookie(userEntity, userBean, expireDays, cookieKey);
        });
    }
991475
@SuppressWarnings("unchecked")
    public <T extends IEntity> T update(T entity) throws FMSException {

        IntuitMessage intuitMessage = prepareUpdate(entity);

        //execute interceptors
        executeInterceptors(intuitMessage);

        return (T) retrieveEntity(intuitMessage);
    }
620935
public T update(String entityId, Map<String, Object> hash) throws AuthenticationException, ApiException, InvalidRequestException {
		return update(entityId, hash, getAuthenticatedClient());
	}
318678
public function setCode4User(UserInterface $userEntity, $type, $expire = null)
    {
        $entityManager = $this->entityManager;

        $this->getRepositoryManager()->deleteCodes4User($userEntity->getId(), $type);

        do {
            $found = false;
            $code = $this->formatService->getCode();
            if ($this->getRepositoryManager()->getCode($code)) {
                $found = true;
            }
        } while ($found);

        $userCodesEntity = new Entity();
        $userCodesEntity->setCode($code)
            ->setUser($userEntity)
            ->setType($type);

        if (!$expire) {
            $expireOption = $this->collectionOptions->getUserCodesOptions()->getExpire();
            $expire = $expireOption[$type] ?? $expireOption['general'];
        }

        if ($expire) {
            $dateTime = new DateTime();
            $userCodesEntity->setExpire($dateTime->setTimestamp(time() + $expire));
        }

        $entityManager->persist($userCodesEntity);
        $entityManager->flush();

        return $code;
    }
637647
public function update($userId, $payload)
    {
        if (isset($payload['meta']) && ! isset($payload['meta']['terms_and_cond'])) {
            throw new Exception("You must agree to the terms and conditions.", 1);
        }

        try {
            return DB::transaction(function () use ($userId, $payload) {
                $user = $this->model->find($userId);

                if (isset($payload['meta']['marketing']) && ($payload['meta']['marketing'] == 1 || $payload['meta']['marketing'] == 'on')) {
                    $payload['meta']['marketing'] = 1;
                } else {
                    $payload['meta']['marketing'] = 0;
                }

                if (isset($payload['meta']['terms_and_cond']) && ($payload['meta']['terms_and_cond'] == 1 || $payload['meta']['terms_and_cond'] == 'on')) {
                    $payload['meta']['terms_and_cond'] = 1;
                } else {
                    $payload['meta']['terms_and_cond'] = 0;
                }

                $userMetaResult = (isset($payload['meta'])) ? $user->meta->update($payload['meta']) : true;

                $user->update($payload);

                if (isset($payload['roles'])) {
                    $this->unassignAllRoles($userId);
                    $this->assignRole($payload['roles'], $userId);
                }

                return $user;
            });
        } catch (Exception $e) {
            throw new Exception("We were unable to update your profile", 1);
        }
    }
233355
public function getUserEntity($user)
    {
        if (is_numeric($user)) {
            $userEntity = $this->entityTypeManager
                ->getStorage('user')
                ->load($user);
        } else {
            $userEntities = $this->entityTypeManager
                ->getStorage('user')
                ->loadByProperties(['name' => $user]);
            $userEntity = reset($userEntities);
        }

        return $userEntity;
    }
257944
protected function updateAuthToken(Entity\Users $userEntity)
    {
        $userName = $userEntity->getUsername();
        $cookieLifetime = (int) $this->cookieOptions['lifetime'];
        $repo = $this->getRepositoryAuthtoken();
        try {
            $tokenEntity = $repo->getUserToken($userEntity->getId(), $this->getClientIp(), $this->getClientUserAgent());
        } catch (DriverException $e) {
            /** @deprecated workaround until v4 */
            if (strpos('no such column: user_id', $e->getMessage()) !== false) {
                throw $e;
            }
            $tokenEntity = false;
        }

        if ($tokenEntity) {
            $token = $tokenEntity->getToken();
        } else {
            $salt = $this->randomGenerator->generateString(32);
            $token = $this->getAuthToken($userEntity->getId(), $salt);

            $tokenEntity = new Entity\Authtoken();
            $tokenEntity->setUserId($userEntity->getId());
            $tokenEntity->setToken($token);
            $tokenEntity->setSalt($salt);
        }

        $tokenEntity->setValidity(Carbon::create()->addSeconds($cookieLifetime));
        $tokenEntity->setIp($this->getClientIp());
        $tokenEntity->setLastseen(Carbon::now());
        $tokenEntity->setUseragent($this->getClientUserAgent());

        try {
            $this->getRepositoryAuthtoken()->save($tokenEntity);
        } catch (DriverException $e) {
            /** @deprecated workaround until v4 */
            if (strpos('no such column: user_id', $e->getMessage()) !== false) {
                throw $e;
            }
        }

        $this->systemLogger->debug("Saving new login token '$token' for user ID '$userName'", ['event' => 'authentication']);

        return $tokenEntity;
    }
1078559
public T update(String entityId, Map<String, Object> hash, MnoHttpClient httpClient) throws AuthenticationException, ApiException, InvalidRequestException {
		String jsonBody = httpClient.put(getInstanceUrl(entityId), GSON.toJson(MnoMapHelper.toUnderscoreHash(hash)));

		Type parsingType = new MnoAccountResponseParameterizedType(entitityClass);
		MnoAccountResponse<T> resp = GSON.fromJson(jsonBody, parsingType);
		resp.validate();

		return resp.getData();
	}
382956
public function updateUserAsync($user_id, $payload_account)
    {
        return $this->updateUserAsyncWithHttpInfo($user_id, $payload_account)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }