// Updates account information for the authenticated user
167335
func (s *AccountService) UpdateAccount(p *UpdateAccountParams) (*UpdateAccountResponse, error) {
	resp, err := s.cs.newRequest("updateAccount", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r UpdateAccountResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
161701
func (c *FakeUserIdentityMappings) Update(userIdentityMapping *user.UserIdentityMapping) (result *user.UserIdentityMapping, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootUpdateAction(useridentitymappingsResource, userIdentityMapping), &user.UserIdentityMapping{})
	if obj == nil {
		return nil, err
	}
	return obj.(*user.UserIdentityMapping), err
}
1191545
func (api *API) UpdateSharedStorageCredentials(new_pass string) ([]SharedStorageAccess, error) {
	result := []SharedStorageAccess{}
	req := struct {
		Password string `json:"password"`
	}{new_pass}
	url := createUrl(api, sharedStoragePathSegment, "access")
	err := api.Client.Put(url, &req, &result, http.StatusAccepted)
	if err != nil {
		return nil, err
	}
	return result, nil
}
1299827
func (s *authenticationProviderServiceImpl) UpdateIdentityUsingUserInfoEndPoint(ctx context.Context, accessToken string) (*account.Identity, error) {
	userProfile, err := s.Factories().IdentityProviderFactory().NewIdentityProvider(ctx, s.config).Profile(ctx, oauth2.Token{AccessToken: accessToken})

	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"token": accessToken,
			"err":   err,
		}, "unable to get user profile")
		return nil, errors.New("unable to get user profile " + err.Error())
	}

	// Set the user profile's username in the context
	profileCtx := ctx.Value(provider.UserProfileContextKey)
	if pCtx, ok := profileCtx.(*provider.UserProfileContext); ok {
		pCtx.Username = &userProfile.Username
	}

	identity := &account.Identity{}

	identities, err := s.Repositories().Identities().Query(account.IdentityFilterByUsername(userProfile.Username), account.IdentityWithUser())
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err": err,
		}, "unable to query for an identity by username")
		return nil, errs.Wrapf(err, "error during querying for an identity by ID")
	}

	if len(identities) == 0 {
		return nil, autherrors.NewUnauthorizedError(fmt.Sprintf("user '%s' is not approved", userProfile.Username))
	}
	identity = &identities[0]

	// we had done a
	// s.Repositories().Identities().Query(account.IdentityFilterByUsername(userProfile.Username), account.IdentityWithUser())
	// so, identity.user should have been populated.

	if identity.User.ID == uuid.Nil {
		log.Error(ctx, map[string]interface{}{
			"identity_id": identity.ID,
		}, "token identity is not linked to any user")
		return nil, errors.New("token identity is not linked to any user")
	}

	if !identity.RegistrationCompleted {
		err = fillUserFromUserInfo(*userProfile, identity)
		if err != nil {
			return nil, autherrors.NewInternalError(ctx, err)
		}
		identity.RegistrationCompleted = true
		err = s.ExecuteInTransaction(func() error {
			// Using the old-fashioned service
			err := s.Repositories().Identities().Save(ctx, identity)
			if err != nil {
				return err
			}
			err = s.Repositories().Users().Save(ctx, &identity.User)
			if err != nil {
				return err
			}
			return nil
		})
	}
	return identity, err
}
414477
func (s *Server) UpdateAccountClaims(a *Account, ac *jwt.AccountClaims) {
	s.updateAccountClaims(a, ac)
}
372408
func (s *AccountService) GetUserInformation() (*Account, *http.Response, error) {
	u := "v2/account"

	req, err := s.client.NewRequest("GET", u, nil)
	if err != nil {
		return nil, nil, err
	}

	ar := new(AccountResponse)
	resp, err := s.client.Do(req, ar)
	if err != nil {
		return nil, resp, err
	}
	return &ar.Account, resp, err
}
847847
func (a *accounter) Update() {
	c := atomic.LoadInt64(&a.current)
	if c != a.currentValue {
		a.write(c)
		a.currentValue = c
	}
}
1047065
func UpdateIPUser(client *TwilioIPMessagingClient, serviceSid string, sid string, identity string, roleSid string) (*IPUser, error) {
	var user *IPUser

	params := url.Values{}
	params.Set("Identity", identity)
	params.Set("RoleSid", roleSid)

	res, err := client.post(params, "/Services/"+serviceSid+"/Users/"+sid+".json")

	if err != nil {
		return user, err
	}

	user = new(IPUser)
	err = json.Unmarshal(res, user)

	return user, err
}
168348
func (c *FakeServiceAccounts) Update(serviceAccount *corev1.ServiceAccount) (result *corev1.ServiceAccount, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewUpdateAction(serviceaccountsResource, c.ns, serviceAccount), &corev1.ServiceAccount{})

	if obj == nil {
		return nil, err
	}
	return obj.(*corev1.ServiceAccount), err
}
576156
func (m *Manager) UpdateAuthorization(authorization *Authorization) (err error) {
	_, err = m.getAuthorizationCollection().Upsert(bson.M{"username": authorization.Username, "grantedto": authorization.GrantedTo}, authorization)
	return
}
494061
func (s *UserService) UpdateUser(ctx context.Context, id influxdb.ID, upd influxdb.UserUpdate) (*influxdb.User, error) {
	if err := authorizeWriteUser(ctx, id); err != nil {
		return nil, err
	}

	return s.s.UpdateUser(ctx, id, upd)
}
577091
func (c *Client) UpdateUser(ctx context.Context, id platform.ID, upd platform.UserUpdate) (*platform.User, error) {
	var u *platform.User
	err := c.db.Update(func(tx *bolt.Tx) error {
		usr, pe := c.updateUser(ctx, tx, id, upd)
		if pe != nil {
			return &platform.Error{
				Err: pe,
				Op:  getOp(platform.OpUpdateUser),
			}
		}
		u = usr
		return nil
	})

	return u, err
}
184139
func (t *AccountService) Info() (*AccountInfoResponse, error) {
	u := &url.Values{}
	v := AccountInfoResponse{}
	if err := t.client.do("account.info", u, &v.Response); err != nil {
		return nil, err
	}

	if err := json.Unmarshal(v.RawData, &v.AccountInfo); err != nil {
		return nil, err
	}
	return &v, nil
}
1119146
func (c *FakeOAuthAccessTokens) Update(oAuthAccessToken *oauth.OAuthAccessToken) (result *oauth.OAuthAccessToken, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootUpdateAction(oauthaccesstokensResource, oAuthAccessToken), &oauth.OAuthAccessToken{})
	if obj == nil {
		return nil, err
	}
	return obj.(*oauth.OAuthAccessToken), err
}
266108
func (s *Service) AccountUpdate(ctx context.Context, o AccountUpdateOpts) (*Account, error) {
	var account Account
	return &account, s.Patch(ctx, &account, fmt.Sprintf("/account"), o)
}
810048
func (c *UsersClient) Update(ctx context.Context, id ID, updateUser *UpdateUser) (*User, error) {
	idBytes, err := id.MarshalText()
	if err != nil {
		return nil, err
	}

	p := fmt.Sprintf("/users/%s", string(idBytes))

	req, err := c.backend.NewRequest(http.MethodPatch, p, nil, updateUser)
	if err != nil {
		return nil, err
	}

	var resp User
	_, err = c.backend.Do(ctx, req, &resp, func(code int) error {
		return &Error{}
	})
	if err != nil {
		return nil, err
	}

	return &resp, nil
}
983032
func (u *UsersClient) Update(ctx context.Context, delta apitypes.ProfileUpdate) (envelope.UserInf, error) {
	e := envelope.Unsigned{}
	err := u.client.DaemonRoundTrip(ctx, "PATCH", "/self", nil, &delta, &e, nil)
	if err != nil {
		return nil, err
	}

	return envelope.ConvertUser(&e)
}