// CreateUser creates a new User and sets b.ID with the new identifier.
492937
func (s *UserService) CreateUser(ctx context.Context, User *platform.User) error {
	return s.CreateUserFn(ctx, User)
}
1241246
func (s *EndpointRequest) SetUser(v *EndpointUser) *EndpointRequest {
	s.User = v
	return s
}
915486
func (s *UserService) CreateUser(ctx context.Context, u *platform.User) error {
	url, err := newURL(s.Addr, usersPath)
	if err != nil {
		return err
	}

	octets, err := json.Marshal(u)
	if err != nil {
		return err
	}

	req, err := http.NewRequest("POST", url.String(), bytes.NewReader(octets))
	if err != nil {
		return err
	}

	req.Header.Set("Content-Type", "application/json")
	SetToken(s.Token, req)

	hc := newClient(url.Scheme, s.InsecureSkipVerify)

	resp, err := hc.Do(req)
	if err != nil {
		return err
	}

	// TODO(jsternberg): Should this check for a 201 explicitly?
	if err := CheckError(resp, true); err != nil {
		return err
	}

	if err := json.NewDecoder(resp.Body).Decode(u); err != nil {
		return err
	}

	return nil
}
632867
func (c *FakeIdentities) Create(identity *user.Identity) (result *user.Identity, err error) {
	obj, err := c.Fake.
		Invokes(testing.NewRootCreateAction(identitiesResource, identity), &user.Identity{})
	if obj == nil {
		return nil, err
	}
	return obj.(*user.Identity), err
}
1084698
func (s *GetDataSourceOutput) SetCreatedByIamUser(v string) *GetDataSourceOutput {
	s.CreatedByIamUser = &v
	return s
}
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())
	}
}
809232
func (s *AdminDisableProviderForUserInput) SetUser(v *ProviderUserIdentifierType) *AdminDisableProviderForUserInput {
	s.User = v
	return s
}
626814
func (s *KeyGen) Create(user string, details string) (err error) {
	guid := s.guidMaker.Create()
	hash := createHash(user, guid)
	row := map[string]string{
		HMFieldActive:  "true",
		HMFieldDetails: details,
	}
	_, err = s.store().Do("HMSET", redis.Args{hash}.AddFlat(row)...)
	return
}
203434
func CreateAndGrantDBUser(session *gorethink.Session, dbName, username, password string) error {
	var err error
	logrus.Debugf("creating user %s for db %s", username, dbName)
	// If the password is empty, pass false to the password parameter
	if password == "" {
		err = gorethink.DB("rethinkdb").Table("users").Insert(map[string]interface{}{
			"id":       username,
			"password": false,
		}).Exec(session)
	} else {
		err = gorethink.DB("rethinkdb").Table("users").Insert(map[string]string{
			"id":       username,
			"password": password,
		}).Exec(session)
	}

	if err != nil {
		return fmt.Errorf("unable to add user %s to rethinkdb users table: %s", username, err)
	}

	// Grant read and write permission
	return gorethink.DB(dbName).Grant(username, map[string]bool{
		"read":  true,
		"write": true,
	}).Exec(session)
}
473848
func (m *GormUserRepository) Create(ctx context.Context, u *User) error {
	defer goa.MeasureSince([]string{"goa", "db", "user", "create"}, time.Now())
	if u.ID == uuid.Nil {
		u.ID = uuid.NewV4()
	}

	err := m.db.Create(u).Error
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"user_id": u.ID,
			"err":     err,
		}, "unable to create the user")
		return errs.WithStack(err)
	}
	log.Debug(ctx, map[string]interface{}{
		"user_id": u.ID,
	}, "User created!")
	return nil
}
334319
func (st *State) AddUser(name, displayName, password, creator string) (*User, error) {
	return st.addUser(name, displayName, password, creator, nil)
}
1145545
func (c *identities) Create(identity *user.Identity) (result *user.Identity, err error) {
	result = &user.Identity{}
	err = c.client.Post().
		Resource("identities").
		Body(identity).
		Do().
		Into(result)
	return
}
233933
func (c *CloudPersister) AddUser(b *models.User) (*models.User, error) {
	ctx := context.Background()
	k := datastore.NewIncompleteKey(ctx, "User", nil)
	k, err := c.DatastoreClient().Put(ctx, k, b)
	if err != nil {
		return nil, fmt.Errorf("datastoredb: could not put User: %v", err)
	}
	b.ID = k.ID()
	return b, nil
}
445522
func SetUser(ctx context.Context, user string) context.Context {
	return context.WithValue(ctx, UserIdentityKey, user)
}
1189112
func (s *BatchPrediction) SetCreatedByIamUser(v string) *BatchPrediction {
	s.CreatedByIamUser = &v
	return s
}
31499
func (f *Facade) CreateSystemUser(ctx datastore.Context) error {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.CreateSystemUser"))
	user, err := f.GetUser(ctx, SYSTEM_USER_NAME)
	if err != nil {
		plog.WithError(err).Warning("Default user not found; creating one.")

		// create the system user
		user := userdomain.User{}
		user.Name = SYSTEM_USER_NAME

		if err := f.AddUser(ctx, user); err != nil {
			return err
		}
	}

	// update the instance password
	password, err := utils.NewUUID36()
	if err != nil {
		return err
	}
	user.Name = SYSTEM_USER_NAME
	user.Password = password
	INSTANCE_PASSWORD = password
	return f.UpdateUser(ctx, user)
}
1183791
func (m *UserManager) Create(email, first, last, clear string) (User, error) {
	return m.create(email, first, last, clear, false)
}