// SaveUser saves a user
18952
func SaveUser(host, token, id string, doc map[string]interface{}) (*map[string]interface{}, error) {
	path := variables.APIPathUser
	path = strings.Replace(path, ":id", id, 1)
	doc["_id"] = id
	return GenericRequest(host, path, token, doc)
}
388937
func (u *UserResource) createUser(request *restful.Request, response *restful.Response) {
	usr := User{Id: request.PathParameter("user-id")}
	err := request.ReadEntity(&usr)
	if err == nil {
		u.users[usr.Id] = usr
		response.WriteHeaderAndEntity(http.StatusCreated, usr)
	} else {
		response.AddHeader("Content-Type", "text/plain")
		response.WriteErrorString(http.StatusInternalServerError, err.Error())
	}
}
1279844
func (m *MetaClient) CreateUser(ctx context.Context, name, passwd string) error {
	return m.CreateUpdateUser(ctx, "create", name, passwd)
}
867772
func (m *Manager) SaveMember(organization *Organization, username string) error {
	return m.collection.Update(
		bson.M{"globalid": organization.Globalid},
		bson.M{"$addToSet": bson.M{"members": username}})
}
749086
func (u *usersService) CreateUser(email, fullname string) (schema.User, error) {
	return u.db.Insert(email, fullname)
}
903570
func (user *User) SaveSetting(key string, value interface{}) error {

	if user.ID == 0 {
		return errors.New("SaveSetting: user is empty")
	}

	key = strings.ToLower(key)
	serviceID := user.ctx.getServiceID()

	var ud userData
	_, err := user.ctx.db.C("users").FindId(user.ID).Select(bson.M{"settings." + serviceID: 1}).
		Apply(
		mgo.Change{
			Update: bson.M{
				"$set":         bson.M{"settings." + serviceID + "." + key: value},
				"$setOnInsert": bson.M{"createdat": time.Now()},
			},
			Upsert:    true,
			ReturnNew: true,
		},
		&ud)

	if err == nil && user.data != nil && user.data.Settings != nil && ud.Settings != nil && ud.Settings[serviceID] != nil {
		user.data.Settings[serviceID] = ud.Settings[serviceID]
	}

	return err
}
33521
func (s *UserService) CreateUser(p *CreateUserParams) (*CreateUserResponse, error) {
	resp, err := s.cs.newRequest("createUser", p.toURLValues())
	if err != nil {
		return nil, err
	}

	if resp, err = getRawValue(resp); err != nil {
		return nil, err
	}

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

	return &r, nil
}
933524
func (e *Editor) User(username string, password string) *Editor {
	e.config.Username = username
	e.config.Password = password
	return e
}
487801
func (n *nessusImpl) EditUser(userID int, permissions, name, email string) (*User, error) {
	if n.verbose {
		log.Println("Editing user...")
	}
	data := editUserRequest{}

	if permissions != "" {
		data.Permissions = permissions
	}
	if name != "" {
		data.Name = name
	}
	if email != "" {
		data.Email = email
	}

	resp, err := n.doRequest("PUT", fmt.Sprintf("/users/%d", userID), data, []int{http.StatusOK})
	if err != nil {
		return nil, err
	}
	defer resp.Body.Close()
	reply := &User{}
	if err = json.NewDecoder(resp.Body).Decode(&reply); err != nil {
		return nil, err
	}
	return reply, nil
}
1200103
func (c *Config) User() string {
	switch c.Type {
	case "ssh":
		return c.SSHUsername
	case "winrm":
		return c.WinRMUser
	default:
		return ""
	}
}
127459
func (conn *Conn) User(ident, name string) {
	conn.Raw(USER + " " + ident + " 12 * :" + name)
}
781805
func (c *client) CreateUser(ctx context.Context, name string, options *UserOptions) (User, error) {
	input := struct {
		UserOptions
		Name string `json:"user"`
	}{
		Name: name,
	}
	if options != nil {
		input.UserOptions = *options
	}
	req, err := c.conn.NewRequest("POST", path.Join("_api/user"))
	if err != nil {
		return nil, WithStack(err)
	}
	if _, err := req.SetBody(input); err != nil {
		return nil, WithStack(err)
	}
	resp, err := c.conn.Do(ctx, req)
	if err != nil {
		return nil, WithStack(err)
	}
	if err := resp.CheckStatus(201); 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
}
426132
func (c *ReactionsListCall) User(user string) *ReactionsListCall {
	c.user = user
	return c
}
1185270
func (m *UserManager) createUser(user *User) error {
	email := sol.Select(
		Users.C("email"),
	).Where(Users.C("email").Equals(user.Email)).Limit(1)

	var duplicate string
	m.conn.Query(email, &duplicate)
	if duplicate != "" {
		return fmt.Errorf(
			"auth: user with email %s already exists", duplicate,
		)
	}

	// Insert the new user
	m.conn.Query(postgres.Insert(Users).Values(user).Returning(), user)
	return nil
}
806087
func (f UserConversionFunc) User(chain []*x509.Certificate) (*authenticator.Response, bool, error) {
	return f(chain)
}
544378
func (ip *Interpreter) user(args []string) {
	uid, err := ip.Backend.CreateUser(args[0], args[1])
	ip.intResponder(uid, err)
}
713808
func (_m *FacadeInterface) UpdateUser(ctx datastore.Context, u user.User) error {
	ret := _m.Called(ctx, u)

	var r0 error
	if rf, ok := ret.Get(0).(func(datastore.Context, user.User) error); ok {
		r0 = rf(ctx, u)
	} else {
		r0 = ret.Error(0)
	}

	return r0
}