// UpdateUser updates the provided user with any provided fields and on success
// returns the updated at time.
13297
func (c *Client) UpdateUser(user User) (updateTime time.Time, err error) {
	payload, err := json.Marshal(user)
	uri := fmt.Sprintf("/1/users/%s", user.ObjectID())
	resp, err := c.doWithBody("PUT", uri, bytes.NewReader(payload))
	log.Println("OI", string(payload))
	c.trace("UpdateUser >", uri, string(payload))
	if err != nil {
		return updateTime, err
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return updateTime, err
	}
	c.trace("UpdateUser < ", uri, string(body))
	updatedAt := &struct {
		Time time.Time `json:"updatedAt"`
	}{}
	err = json.Unmarshal(body, updatedAt)
	return updatedAt.Time, err
}
1017937
func (c *users) Update(userResource *user.User) (result *user.User, err error) {
	result = &user.User{}
	err = c.client.Put().
		Resource("users").
		Name(userResource.Name).
		Body(userResource).
		Do().
		Into(result)
	return
}
1262060
func (s *EndpointResponse) SetUser(v *EndpointUser) *EndpointResponse {
	s.User = v
	return s
}
85816
func (org *Organization) UpdateUser(user UserChange) error {
	var (
		r userUpdateResponse
		b bytes.Buffer
	)
	err := json.NewEncoder(&b).Encode(user)
	if err != nil {
		return err
	}
	err = org.PPE.put(fmt.Sprintf("/orgs/%s/users/%s", org.PrimaryDomain, user.PrimaryEmail), &b, &r)
	if err != nil {
		return err
	}
	if r.ResultCode != 0 {
		return errors.New(r.Message)
	}
	return nil
}
633313
func (s *ContainerProperties) SetUser(v string) *ContainerProperties {
	s.User = &v
	return s
}
964602
func NewUpdateUser(ctx *middleware.Context, handler UpdateUserHandler) *UpdateUser {
	return &UpdateUser{Context: ctx, Handler: handler}
}
824989
func (c *Client) UpsertUser(user services.User) error {
	data, err := services.GetUserMarshaler().MarshalUser(user)
	if err != nil {
		return trace.Wrap(err)
	}
	_, err = c.PostJSON(c.Endpoint("users"), &upsertUserRawReq{User: data})
	return trace.Wrap(err)
}
1241246
func (s *EndpointRequest) SetUser(v *EndpointUser) *EndpointRequest {
	s.User = v
	return s
}
1071305
func (s *Server) UpdatePassword(ctx context.Context, q *UpdatePasswordRequest) (*UpdatePasswordResponse, error) {
	username := getAuthenticatedUser(ctx)
	if username != common.ArgoCDAdminUsername {
		return nil, status.Errorf(codes.InvalidArgument, "password can only be changed for local users, not user %q", username)
	}

	cdSettings, err := s.settingsMgr.GetSettings()
	if err != nil {
		return nil, err
	}

	err = s.sessionMgr.VerifyUsernamePassword(username, q.CurrentPassword)
	if err != nil {
		return nil, status.Errorf(codes.InvalidArgument, "current password does not match")
	}

	hashedPassword, err := password.HashPassword(q.NewPassword)
	if err != nil {
		return nil, err
	}

	cdSettings.AdminPasswordHash = hashedPassword
	cdSettings.AdminPasswordMtime = time.Now().UTC()

	err = s.settingsMgr.SaveSettings(cdSettings)
	if err != nil {
		return nil, err
	}
	log.Infof("user '%s' updated password", username)
	return &UpdatePasswordResponse{}, nil

}
641704
func (s *Service) UpdateUser(ctx context.Context, id influxdb.ID, upd influxdb.UserUpdate) (*influxdb.User, error) {
	var u *influxdb.User
	err := s.kv.Update(ctx, func(tx Tx) error {
		usr, err := s.updateUser(ctx, tx, id, upd)
		if err != nil {
			return err
		}
		u = usr
		return nil
	})

	if err != nil {
		return nil, err
	}

	return u, nil
}
996017
func UpdatePerson(db *sql.DB, firstName, lastName string, age uint, newPerson Person) error {
	_, err := db.Exec(
		fmt.Sprintf(
			"UPDATE %s SET %s=?,%s=?,%s=? WHERE %s=? AND %s=? AND %s=?",
			PersonTableName,
			PersonFirstNameCol,
			PersonLastNameCol,
			PersonAgeCol,
			PersonFirstNameCol,
			PersonLastNameCol,
			PersonAgeCol,
		),
		newPerson.FirstName,
		newPerson.LastName,
		newPerson.Age,
		firstName,
		lastName,
		age,
	)
	return err
}
351462
func (s *GetCurrentUserOutput) SetUser(v *User) *GetCurrentUserOutput {
	s.User = v
	return s
}
1122257
func (s *Service) AccountUpdateByUser(ctx context.Context, accountIdentity string, o AccountUpdateByUserOpts) (*Account, error) {
	var account Account
	return &account, s.Patch(ctx, &account, fmt.Sprintf("/users/%v", accountIdentity), o)
}
164842
func (r *Client) UpdateOrgUser(user UserRole, oid, uid uint) (StatusMessage, error) {
	var (
		raw   []byte
		reply StatusMessage
		err   error
	)
	if raw, err = json.Marshal(user); err != nil {
		return StatusMessage{}, err
	}
	if raw, _, err = r.patch(fmt.Sprintf("api/orgs/%d/users/%d", oid, uid), nil, raw); err != nil {
		return StatusMessage{}, err
	}
	err = json.Unmarshal(raw, &reply)
	return reply, err
}
143935
func (s *UsersStore) Update(ctx context.Context, u *chronograf.User) error {
	return s.UpdateF(ctx, u)
}
228295
func (c *UserServiceController) Update(ctx *app.UpdateUserServiceContext) error {
	c.UpdateTenant(ctx)
	return ctx.OK([]byte{})
}
125725
func (s *GetUserOutput) SetUser(v *User) *GetUserOutput {
	s.User = v
	return s
}