Versions in this module Expand all Collapse all v0 v0.4.0 Oct 23, 2024 v0.3.2 Oct 15, 2024 v0.3.1 Oct 11, 2024 v0.3.0 Oct 11, 2024 v0.2.0 Sep 11, 2024 v0.1.1 Aug 19, 2024 v0.1.0 Aug 18, 2024 Changes in this version + var DefaultAllowBadLine = true — darwin/amd64, linux/amd64 + var DefaultAllowBadName = true — darwin/amd64, linux/amd64 + var DefaultCreateFilesIfAbsent = false — darwin/amd64, linux/amd64 + var DefaultEtcGroup = "/etc/group" — darwin/amd64, linux/amd64 + var DefaultEtcPasswd = "/etc/passwd" — darwin/amd64, linux/amd64 + var DefaultEtcShadow = "/etc/shadow" — darwin/amd64, linux/amd64 + var DefaultFileSystemSyncThreshold = time.Second * 2 — darwin/amd64, linux/amd64 + var DefaultRepositoryProvider RepositoryProvider = &failingRepositoryProvider + var ErrGroupDoesNotFulfilRequirement = errors.New("group does not fulfil requirement") + var ErrNoSuchGroup = errors.Newf(errors.Unknown, "no such group") + var ErrNoSuchUser = errors.Newf(errors.Unknown, "no such user") + var ErrUserDoesNotFulfilRequirement = errors.New("user does not fulfil requirement") + func GroupIdEqualsP(a, b *GroupId) bool — darwin/amd64, linux/amd64 + func IdEqualsP(a, b *Id) bool — darwin/amd64, linux/amd64 + type CloseableRepository interface + type DeleteOpts struct + HomeDir *bool + KillProcesses *bool + func (this *DeleteOpts) IsHomeDir() bool + func (this *DeleteOpts) IsKillProcesses() bool + type EnsureOnHomeDirExist uint8 + const EnsureOnHomeDirExistFail + const EnsureOnHomeDirExistOverwrite + const EnsureOnHomeDirExistTakeover + const EnsureOnHomeDirExistUnknown + func (this *EnsureOnHomeDirExist) Set(text string) error + func (this *EnsureOnHomeDirExist) UnmarshalText(text []byte) error + func (this EnsureOnHomeDirExist) Clone() EnsureOnHomeDirExist + func (this EnsureOnHomeDirExist) IsEqualTo(other any) bool + func (this EnsureOnHomeDirExist) IsZero() bool + func (this EnsureOnHomeDirExist) MarshalText() (text []byte, err error) + func (this EnsureOnHomeDirExist) String() string + func (this EnsureOnHomeDirExist) Validate() error + type EnsureOpts struct + CreateAllowed *bool + HomeDir *bool + ModifyAllowed *bool + OnHomeDirExist EnsureOnHomeDirExist + func (this *EnsureOpts) GetOnHomeDirExist() EnsureOnHomeDirExist + func (this *EnsureOpts) IsCreateAllowed() bool + func (this *EnsureOpts) IsHomeDir() bool + func (this *EnsureOpts) IsModifyAllowed() bool + type EnsureResult uint8 + const EnsureResultCreated + const EnsureResultError + const EnsureResultModified + const EnsureResultUnchanged + const EnsureResultUnknown + type Ensurer interface + Ensure func(context.Context, *Requirement, *EnsureOpts) (*User, EnsureResult, error) + EnsureGroup func(context.Context, *GroupRequirement, *EnsureOpts) (*Group, EnsureResult, error) + type EtcColonRepository struct — darwin/amd64, linux/amd64 + AllowBadLine *bool + AllowBadName *bool + CreateFilesIfAbsent *bool + FileSystemSyncThreshold time.Duration + GroupFilename string + Logger log.Logger + OnUnhandledAsyncError func(logger log.Logger, err error, detail string) + PasswdFilename string + ShadowFilename string + func (this *EtcColonRepository) Close() error + func (this *EtcColonRepository) DeleteById(ctx context.Context, id Id, opts *DeleteOpts) (rErr error) + func (this *EtcColonRepository) DeleteByName(ctx context.Context, name string, opts *DeleteOpts) (rErr error) + func (this *EtcColonRepository) DeleteGroupById(ctx context.Context, id GroupId, opts *DeleteOpts) (rErr error) + func (this *EtcColonRepository) DeleteGroupByName(ctx context.Context, name string, opts *DeleteOpts) (rErr error) + func (this *EtcColonRepository) Ensure(ctx context.Context, req *Requirement, opts *EnsureOpts) (_ *User, _ EnsureResult, rErr error) + func (this *EtcColonRepository) EnsureGroup(ctx context.Context, req *GroupRequirement, opts *EnsureOpts) (_ *Group, _ EnsureResult, rErr error) + func (this *EtcColonRepository) Init(ctx context.Context) error + func (this *EtcColonRepository) LookupById(ctx context.Context, id Id) (*User, error) + func (this *EtcColonRepository) LookupByName(ctx context.Context, name string) (*User, error) + func (this *EtcColonRepository) LookupGroupById(ctx context.Context, id GroupId) (*Group, error) + func (this *EtcColonRepository) LookupGroupByName(_ context.Context, name string) (*Group, error) + func (this *EtcColonRepository) ValidatePasswordById(ctx context.Context, id Id, pass string) (bool, error) + func (this *EtcColonRepository) ValidatePasswordByName(ctx context.Context, name string, pass string) (bool, error) + type Group struct — darwin/amd64, linux/amd64 + Gid GroupId + Name string + func (this Group) Clone() (*Group, error) + func (this Group) GetField(name string) (any, bool, error) + func (this Group) IsEqualTo(other any) bool + func (this Group) String() string + type GroupId uint32 — darwin/amd64, linux/amd64 + func (this *GroupId) UnmarshalText(text []byte) error + func (this GroupId) MarshalText() (text []byte, err error) + func (this GroupId) String() string + type GroupRequirement struct — darwin/amd64, linux/amd64 + Gid *GroupId + Name string + func (this GroupRequirement) Clone() GroupRequirement + func (this GroupRequirement) IsEqualTo(other any) bool + func (this GroupRequirement) IsZero() bool + func (this GroupRequirement) OrDefaults() GroupRequirement + func (this GroupRequirement) OrDefaultsForUser(user *Requirement) GroupRequirement + func (this GroupRequirement) String() string + type GroupRequirements []GroupRequirement — darwin/amd64, linux/amd64 + func (this GroupRequirements) Clone() GroupRequirements + func (this GroupRequirements) Contains(other *GroupRequirement) bool + func (this GroupRequirements) IsEqualTo(other any) bool + func (this GroupRequirements) IsZero() bool + type Groups []Group — darwin/amd64, linux/amd64 + func (this Groups) Clone() (*Groups, error) + func (this Groups) Contains(other *Group) bool + func (this Groups) IsEqualTo(other any) bool + func (this Groups) IsZero() bool + type Id uint32 — darwin/amd64, linux/amd64 + func (this *Id) UnmarshalText(text []byte) error + func (this Id) MarshalText() (text []byte, err error) + func (this Id) String() string + type Repository interface + DeleteById func(context.Context, Id, *DeleteOpts) error + DeleteByName func(context.Context, string, *DeleteOpts) error + DeleteGroupById func(context.Context, GroupId, *DeleteOpts) error + DeleteGroupByName func(context.Context, string, *DeleteOpts) error + LookupById func(context.Context, Id) (*User, error) + LookupByName func(context.Context, string) (*User, error) + LookupGroupById func(context.Context, GroupId) (*Group, error) + LookupGroupByName func(context.Context, string) (*Group, error) + ValidatePasswordById func(ctx context.Context, id Id, pass string) (bool, error) + ValidatePasswordByName func(ctx context.Context, name string, pass string) (bool, error) + type RepositoryProvider interface + Create func(context.Context) (CloseableRepository, error) + type Requirement struct — darwin/amd64, linux/amd64 + DisplayName string + Group GroupRequirement + Groups GroupRequirements + HomeDir string + Name string + Shell string + Skel string + Uid *Id + func (this Requirement) Clone() Requirement + func (this Requirement) IsEqualTo(other any) bool + func (this Requirement) IsZero() bool + func (this Requirement) OrDefaults() Requirement + func (this Requirement) String() string + type SharedRepositoryProvider struct + V T + func (this *SharedRepositoryProvider[T]) Create(ctx context.Context) (CloseableRepository, error) + type StringError string + func (this StringError) Error() string + type User struct — darwin/amd64, linux/amd64 + DisplayName string + Group Group + Groups Groups + HomeDir string + Name string + Shell string + Uid Id + func (this User) Clone() (*User, error) + func (this User) GetField(name string) (any, bool, error) + func (this User) IsEqualTo(other any) bool + func (this User) String() string + func (this User) ToCredentials() syscall.Credential