Add or Update a user

@param \Jaspersoft\Dto\User\User
@throws \Jaspersoft\Exception\RESTRequestException
767433
public function addOrUpdateUser($user)
    {
            $url = self::makeUserUrl($user->tenantId, $user->username);
            $this->service->prepAndSend($url, array(200, 201), 'PUT', json_encode($user), true, 'application/json', 'application/json');
    }
746462
protected function refreshRememberToken(UserInterface $user)
    {
        $user->setRememberToken($token = str_random(60));

        $this->provider->updateRememberToken($user, $token);
    }
532284
public function update($user)
    {
        $user = User::find($user);
        if (!$user) {
            return redirect_to_resource();
        }

        $attributes = request()->validate([
            'firstname' => 'required',
            'lastname'  => 'required',
            'cellphone' => 'required',
            'telephone' => 'nullable',
            'born_at'   => 'nullable',
            'etokens'   => 'nullable',
            'email'     => 'required|email|' . Rule::unique('users')->ignore($user->id),
            'roles'     => 'required|array',
        ]);

        unset($attributes['roles']);

        $this->updateEntry($user, $attributes);

        $user->roles()->sync(input('roles'));

        return redirect_to_resource();
    }
733558
public function update(User $user)
    {
        $url = 'users/' . $user->getAppuserid();

        return $this->updateObject($url, $user);
    }
1305510
def add_user(self, **kwargs):
        """"""
        user = self.UserClass(**kwargs)
        if hasattr(user, 'active'):
            user.active = True
        self.db_adapter.add_object(user)
        return user
1042526
public void updateUser(String userDBID, User user) throws ProvisioningApiException {
		try {
			ApiSuccessResponse resp = usersApi.updateUser(userDBID, new UpdateUserData().data(Converters.convertUserToUpdateUserDataData(user)));

			if (!resp.getStatus().getCode().equals(0)) {
				throw new ProvisioningApiException("Error updating user. Code: " + resp.getStatus().getCode());
			}
        } catch(ApiException e) {
        	throw new ProvisioningApiException("Error updating user", e);
        }
	}
851861
public function setUserData(User $user)
    {
        $userVarArray = get_object_vars($user);

        foreach ($userVarArray as $key => $value) {
            if ($value !== null) {
                $this->{$key} = $value;
            }
        }
    }
178142
public function set_user($user)
    {
        if (is_object($user)) {
            $this->user = $user;

            // overwrite config with user preferences
            $this->config->set_user_prefs((array)$this->user->get_prefs());
        }
    }
383855
public void handleUpdateUser(String jsonp, String target,
            HttpServletRequest request,
            HttpServletResponse response, AuthenticationResult ar)
            throws IOException, ServletException {
        String update = request.getParameter("user");
        if (update == null || update.trim().length() == 0) {
            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Failed to get user information."));
            return;
        }
        try {
            User newUser = m_mapper.readValue(update, User.class);
            if (newUser == null) {
                response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
                response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Failed to parse user information."));
                return;
            }

            DeploymentType newDeployment = CatalogUtil.getDeployment(new ByteArrayInputStream(getDeploymentBytes()));
            User user = null;
            String[] splitTarget = target.split("/");
            if (splitTarget.length == 3) {
                user = findUser(splitTarget[2], newDeployment);
            }
            if (user == null) {
                response.setStatus(HttpServletResponse.SC_NOT_FOUND);
                response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "User not found"));
                return;
            }
            user.setName(newUser.getName());
            user.setPassword(newUser.getPassword());
            user.setPlaintext(newUser.isPlaintext());
            user.setRoles(newUser.getRoles());

            String dep = CatalogUtil.getDeployment(newDeployment);
            if (dep == null || dep.trim().length() <= 0) {
                response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
                response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, "Failed to build deployment information."));
                return;
            }
            Object[] params = new Object[]{null, dep};
            //Call sync as nothing else can happen when this is going on.
            SyncCallback cb = new SyncCallback();
            httpClientInterface.callProcedure(request.getRemoteHost(), ar, BatchTimeoutOverrideType.NO_TIMEOUT, cb, "@UpdateApplicationCatalog", params);
            cb.waitForResponse();
            ClientResponseImpl r = ClientResponseImpl.class.cast(cb.getResponse());
            if (r.getStatus() == ClientResponse.SUCCESS) {
                response.getWriter().print(buildClientResponse(jsonp, ClientResponse.SUCCESS, "User Updated."));
            } else {
                response.getWriter().print(HTTPClientInterface.asJsonp(jsonp, r.toJSONString()));
            }

        } catch (Exception ex) {
            m_log.error("Failed to update user from API", ex);
            response.setStatus(HttpServletResponse.SC_BAD_REQUEST);
            response.getWriter().print(buildClientResponse(jsonp, ClientResponse.UNEXPECTED_FAILURE, Throwables.getStackTraceAsString(ex)));
        }
    }
1327236
public void addUser(PrincipalUser user) {
        SystemAssert.requireArgument(user != null, "Null user can not be added.");
        users.add(user);
    }
53950
public function updateRememberToken(UserContract $user, $token)
    {
        $this->conn->table($this->table)
                ->where($user->getAuthIdentifierName(), $user->getAuthIdentifier())
                ->update([$user->getRememberTokenName() => $token]);
    }
533753
public function add( models\VPN\Server\User $user){
        $rest = $this->getService( self::API_VPN_USER);
        $rest->POST( $user);

        return $rest->getResult( models\VPN\Server\User::class);
    }
726068
public void updateUser(User user){
        ProtocolHeader header = new ProtocolHeader();
        header.setType(ProtocolType.UpdateUser);

        UpdateUserProtocol p = new UpdateUserProtocol(user);

        connection.submitRequest(header, p, null);
    }
1320824
public function setUser($user)
    {
        if (\is_object($user)) {
            $this->userObject = $user;
            $this->user       = $user->getId();
        } else {
            $this->userObject = null;
            $this->user       = $user;
        }

        return $this;
    }
66674
public function updateAction(Request $request, $id)
        {

            /** @var User $oUser */
            $oUser = UserQuery::create()->findOneById($id);

            if (count($oUser) === 0) {
                throw $this->createNotFoundException('Unable to find User entity.');
            }

            $deleteForm = $this->createDeleteForm($id);
            $editForm = $this->createEditForm($oUser);
            $editForm->handleRequest($request);

            $aUserRoles = UserRoleQuery::create()->findByUserId($oUser->getId());

            if ($editForm->isValid()) {


                foreach($aUserRoles as $oUserRole){
                    $oUserRole->setUserId($oUser->getId());
                    $oUserRole->delete();
                }
                $aFormData =$request->request->get('slashworks_backendbundle_user');
                $sPassword = $aFormData['password'];
                $sPasswordRepeat = $aFormData['password_repeat'];
                if(!empty($sPassword) && !empty($sPasswordRepeat)){
                    if($sPassword === $sPasswordRepeat){
                        $factory  = $this->get('security.encoder_factory');
                        $encoder  = $factory->getEncoder($oUser);
                        $sPassword = $encoder->encodePassword($sPassword, $oUser->getSalt());
                        $oUser->setPassword($sPassword);
                    }else{

                    }
                }elseif(!empty($sPassword) && empty($sPasswordReqpeat)){

                }

                $oUser->save();

                return $this->redirect($this->generateUrl('backend_system_user'));
            }

            return $this->render('SlashworksBackendBundle:User:edit.html.twig', array(
                'entity'      => $oUser,
                'edit_form'   => $editForm->createView(),
                'delete_form' => $deleteForm->createView(),
            ));
        }
286375
public function updateUser(User $user)
    {
        $this->find("id", $user->id);
        $this->setUserData($user);
        $this->save();
    }
276959
function addUser(req, res, next) {
  res.locals.user = req.user;
  next();
}