// WithUser sets the container's user
489162
func WithUser(c *container.Container) coci.SpecOpts {
	return func(ctx context.Context, _ coci.Client, _ *containers.Container, s *coci.Spec) error {
		uid, gid, additionalGids, err := getUser(c, c.Config.User)
		if err != nil {
			return err
		}
		s.Process.User.UID = uid
		s.Process.User.GID = gid
		s.Process.User.AdditionalGids = additionalGids
		return nil
	}
}
1028916
func (f *Facade) AddUser(ctx datastore.Context, newUser userdomain.User) error {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.AddUser"))
	var err error
	logger := plog.WithFields(log.Fields{
		"newUserName": newUser.Name,
	})
	logger.Debug("Started Facade.AddUser")
	defer logger.WithError(err).Debug("Finished Facade.AddUser")

	name := strings.TrimSpace(newUser.Name)
	newUser.Password = hashPassword(newUser.Password)

	_, err = f.GetUser(ctx, name)
	if err != nil && !datastore.IsErrNoSuchEntity(err) {
		return err
	}
	err = f.userStore.Put(ctx, userdomain.Key(name), &newUser)
	return err
}
687083
func (f UserHandlerFunc) ServeHTTPWithUser(u *User, w http.ResponseWriter, r *http.Request) {
	f(u, w, r)
}
633313
func (s *ContainerProperties) SetUser(v string) *ContainerProperties {
	s.User = &v
	return s
}
981177
func (s *VirtualMFADevice) SetUser(v *User) *VirtualMFADevice {
	s.User = v
	return s
}
1205097
func WithUsername(username string) SpecOpts {
	return func(ctx context.Context, client Client, c *containers.Container, s *Spec) (err error) {
		setProcess(s)
		if s.Linux != nil {
			if c.Snapshotter == "" && c.SnapshotKey == "" {
				if !isRootfsAbs(s.Root.Path) {
					return errors.Errorf("rootfs absolute path is required")
				}
				user, err := getUserFromPath(s.Root.Path, func(u user.User) bool {
					return u.Name == username
				})
				if err != nil {
					return err
				}
				s.Process.User.UID, s.Process.User.GID = uint32(user.Uid), uint32(user.Gid)
				return nil
			}
			if c.Snapshotter == "" {
				return errors.Errorf("no snapshotter set for container")
			}
			if c.SnapshotKey == "" {
				return errors.Errorf("rootfs snapshot not created for container")
			}
			snapshotter := client.SnapshotService(c.Snapshotter)
			mounts, err := snapshotter.Mounts(ctx, c.SnapshotKey)
			if err != nil {
				return err
			}
			return mount.WithTempMount(ctx, mounts, func(root string) error {
				user, err := getUserFromPath(root, func(u user.User) bool {
					return u.Name == username
				})
				if err != nil {
					return err
				}
				s.Process.User.UID, s.Process.User.GID = uint32(user.Uid), uint32(user.Gid)
				return nil
			})
		} else if s.Windows != nil {
			s.Process.User.Username = username
		} else {
			return errors.New("spec does not contain Linux or Windows section")
		}
		return nil
	}
}
639384
func (s *Server) WithAuthentication(scheme AuthenticationScheme) *Server {
	s.authentication = scheme
	return s
}
1001096
func (a *Account) WithAuth(strategy auth.Strategy) *Account {
	a.auth = strategy
	return a
}
137003
func (b ConnectionStringBuilder) WithUser(user string) ConnectionStringBuilder {
	b.user = user
	return b
}
492937
func (s *UserService) CreateUser(ctx context.Context, User *platform.User) error {
	return s.CreateUserFn(ctx, User)
}
722473
func WithUsers(users map[string]msp.SigningIdentity) UsersOption {
	return func(mgr *UsersOptions) error {
		if mgr.users != nil {
			return errors.New("already initialized")
		}
		mgr.users = users
		return nil
	}
}
1039306
func (s *RegisterUserOutput) SetUser(v *User) *RegisterUserOutput {
	s.User = v
	return s
}
46904
func (c *Client) EnableUser(p *EnableUserParameter) (*User, error) {
	obj, err := c.Request("enableUser", convertParamToMap(p))
	if err != nil {
		return nil, err
	}
	return obj.(*User), err
}
911719
func (s *CPUUtilization) SetUser(v float64) *CPUUtilization {
	s.User = &v
	return s
}
558507
func (cli *OpsGenieClient) User() (*OpsGenieUserClient, error) {
	cli.makeHTTPTransportSettings()

	userClient := new(OpsGenieUserClient)
	userClient.SetOpsGenieClient(*cli)

	if cli.opsGenieAPIURL == "" {
		userClient.SetOpsGenieAPIUrl(endpointURL)
	}

	return userClient, nil
}
1067460
func WithProviderUser(username string, org string) ProviderOption {
	return func(opts *ProviderUsersOptions) error {

		si := mspmocks.NewMockSigningIdentity(username, org)
		opts.identity = si

		userMap := make(map[string]msp.SigningIdentity)
		userMap[username] = si
		orgMap := make(map[string]map[string]msp.SigningIdentity)
		orgMap[org] = userMap
		opts.users = orgMap

		return nil
	}
}
325409
func WithUser(parent context.Context, user User) context.Context {
	return context.WithValue(parent, userKey, user)
}