// User sets the value for optional user parameter
322425
func (c *RemindersAddCall) User(user string) *RemindersAddCall {
	c.user = user
	return c
}
299748
func (s *ActivateUserOutput) SetUser(v *User) *ActivateUserOutput {
	s.User = v
	return s
}
658947
func (s *UserService) LockUser(p *LockUserParams) (*LockUserResponse, error) {
	resp, err := s.cs.newRequest("lockUser", p.toURLValues())
	if err != nil {
		return nil, err
	}

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

	return &r, nil
}
1291769
func (api *UserManagerAPI) AddUser(args params.AddUsers) (params.AddUserResults, error) {
	var result params.AddUserResults

	if err := api.check.ChangeAllowed(); err != nil {
		return result, errors.Trace(err)
	}

	if len(args.Users) == 0 {
		return result, nil
	}

	// Create the results list to populate.
	result.Results = make([]params.AddUserResult, len(args.Users))

	isSuperUser, err := api.hasControllerAdminAccess()
	if err != nil {
		return result, errors.Trace(err)
	}
	if !isSuperUser {
		return result, common.ErrPerm
	}

	for i, arg := range args.Users {
		var user *state.User
		var err error
		if arg.Password != "" {
			user, err = api.state.AddUser(arg.Username, arg.DisplayName, arg.Password, api.apiUser.Id())
		} else {
			user, err = api.state.AddUserWithSecretKey(arg.Username, arg.DisplayName, api.apiUser.Id())
		}
		if err != nil {
			err = errors.Annotate(err, "failed to create user")
			result.Results[i].Error = common.ServerError(err)
			continue
		} else {
			result.Results[i] = params.AddUserResult{
				Tag:       user.Tag().String(),
				SecretKey: user.SecretKey(),
			}
		}

	}
	return result, nil
}
165276
func (search *Search) User(user string) (*SearchResult, error) {
	insta := search.inst
	body, err := insta.sendRequest(
		&reqOptions{
			Endpoint: urlSearchUser,
			Query: map[string]string{
				"ig_sig_key_version": goInstaSigKeyVersion,
				"is_typeahead":       "true",
				"query":              user,
				"rank_token":         insta.rankToken,
			},
		},
	)
	if err != nil {
		return nil, err
	}

	res := &SearchResult{}
	err = json.Unmarshal(body, res)
	return res, err
}
118725
func (p *Pod) SetUser(user string) *Pod {
	p.User = user
	return p
}
546855
func (s *AdminCreateUserOutput) SetUser(v *UserType) *AdminCreateUserOutput {
	s.User = v
	return s
}
271130
func (a *API) CreateUser(user *User) (*User, error) {
	dst := new(User)
	url := a.BuildURL("/v2/user")
	err := a.Post(url, Params{}, user, dst)
	return dst, err
}
1007769
func (c *client) User(ctx context.Context, name string) (User, error) {
	escapedName := pathEscape(name)
	req, err := c.conn.NewRequest("GET", path.Join("_api/user", escapedName))
	if err != nil {
		return nil, WithStack(err)
	}
	resp, err := c.conn.Do(ctx, req)
	if err != nil {
		return nil, WithStack(err)
	}
	if err := resp.CheckStatus(200); err != nil {
		return nil, WithStack(err)
	}
	var data userData
	if err := resp.ParseBody("", &data); err != nil {
		return nil, WithStack(err)
	}
	u, err := newUser(data, c.conn)
	if err != nil {
		return nil, WithStack(err)
	}
	return u, nil
}
1059569
func (b LeveldbAuthBackend) User(username string) (user UserData, e error) {
	if user, ok := b.users[username]; ok {
		return user, nil
	}
	return user, ErrMissingUser
}
255686
func (c *Client) DeleteUser(user User) error {
	uri := fmt.Sprintf("/1/users/%s", user.ObjectID())
	resp, err := c.doSimple("DELETE", uri)
	defer resp.Body.Close()
	c.trace("DeleteUser", uri)
	return err
}
147096
func (s *ResetPersonalPINOutput) SetUser(v *User) *ResetPersonalPINOutput {
	s.User = v
	return s
}
988958
func (st *State) User(tag names.UserTag) (*User, error) {
	if !tag.IsLocal() {
		return nil, errors.NotFoundf("user %q", tag.Id())
	}
	user := &User{st: st}
	if err := st.getUser(tag.Name(), &user.doc); err != nil {
		return nil, errors.Trace(err)
	}
	if user.doc.Deleted {
		// This error is returned to the apiserver and from there to the api
		// client. So we don't annotate with information regarding deletion.
		// TODO(redir): We'll return a deletedUserError in the future so we can
		// return more appropriate errors, e.g. username not available.
		return nil, DeletedUserError{UserName: user.Name()}
	}
	return user, nil
}
143458
func (c *Client) CreateUser(user User) (*ParseUser, error) {
	payload, err := json.Marshal(user)
	c.trace("CreateUser >", "/1/users", string(payload))
	resp, err := c.doWithBody("POST", "/1/users", bytes.NewReader(payload))
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	body, err := ioutil.ReadAll(resp.Body)
	if err != nil {
		return nil, err
	}
	var u *ParseUser
	err = json.Unmarshal(body, &u)
	c.trace("CreateUser <", "/1/users", string(body))
	return u, err
}
633313
func (s *ContainerProperties) SetUser(v string) *ContainerProperties {
	s.User = &v
	return s
}
135321
func User(userID string, c echo.Context) (*nerdz.User, error) {
	var id uint64
	var e error
	if id, e = strconv.ParseUint(c.Param(userID), 10, 64); e != nil {
		c.JSON(http.StatusBadRequest, &Response{
			HumanMessage: "Invalid user identifier specified",
			Message:      e.Error(),
			Status:       http.StatusBadRequest,
			Success:      false,
		})
		return nil, e
	}

	var user *nerdz.User
	if user, e = nerdz.NewUser(id); e != nil {
		c.JSON(http.StatusBadRequest, &Response{
			HumanMessage: "User does not exists",
			Message:      e.Error(),
			Status:       http.StatusBadRequest,
			Success:      false,
		})
		return nil, e
	}

	me := c.Get("me").(*nerdz.User)
	if !me.CanSee(user) {
		message := "You can't see the required profile"
		c.JSON(http.StatusUnauthorized, &Response{
			HumanMessage: message,
			Message:      message,
			Status:       http.StatusUnauthorized,
			Success:      false,
		})
		return nil, errors.New(message)
	}
	return user, nil
}
1067106
func (api *UserManagerAPI) EnableUser(users params.Entities) (params.ErrorResults, error) {
	isSuperUser, err := api.hasControllerAdminAccess()
	if err != nil {
		return params.ErrorResults{}, errors.Trace(err)
	}
	if !isSuperUser {
		return params.ErrorResults{}, common.ErrPerm
	}

	if err := api.check.ChangeAllowed(); err != nil {
		return params.ErrorResults{}, errors.Trace(err)
	}
	return api.enableUserImpl(users, "enable", (*state.User).Enable)
}