user

package
v2.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DeleteUserData

type DeleteUserData struct {
	Username           string `validate:"required"`
	PurgeHomeDirectory bool   `validate:"omitempty"`
}

DeleteUserData contains data for user deletion

type ModUserData

type ModUserData struct {
	Username   string   `validate:"required"`
	Groupnames []string `validate:"required"`
	Comment    string   `validate:"required"`
}

ModUserData contains data for modifying user

type UserData

type UserData struct {
	Username                string   `validate:"required"`
	UID                     uint64   `validate:"required_unless=IsServiceAccount true"`
	GID                     uint64   `validate:"required_unless=IsServiceAccount true"`
	Comment                 string   `validate:"required"`
	HomeDirectory           string   `validate:"required_unless=IsServiceAccount true"`
	HomeDirectoryPermission string   `validate:"omitempty"`
	Shell                   string   `validate:"required"`
	Groupname               string   `validate:"required"`
	Groups                  []uint64 `validate:"omitempty"`
	IsServiceAccount        bool
}

UserData contains data for user operations.

IsServiceAccount discriminates IAM User provisioning from Application service-account provisioning:

  • IsServiceAccount=false (default, IAM User): UID/GID/HomeDirectory are required. alpacon-server centrally assigns these for cross-server consistency. Missing values indicate a server-side bug and must fail validation rather than silently fall back to OS auto-assignment.
  • IsServiceAccount=true (Application): UID/GID/HomeDirectory are optional. When omitted, the numeric --uid / --gid / --home flag is skipped: UID and HomeDirectory fall back to OS defaults; GID is replaced with `--ingroup <Groupname>` (Debian) or `--gid <Groupname>` (RHEL) so the primary group is set by name. Cross-server consistency is not required because alpacon-server matches service accounts by username.

type UserHandler

type UserHandler struct {
	*common.BaseHandler
	// contains filtered or unexported fields
}

UserHandler handles user management commands

func NewUserHandler

func NewUserHandler(cmdExecutor common.CommandExecutor, groupService services.GroupService, syncManager common.SystemInfoManager) *UserHandler

NewUserHandler creates a new user handler

func (*UserHandler) Execute

func (h *UserHandler) Execute(ctx context.Context, cmd string, args *common.CommandArgs) (int, string, error)

Execute runs the user management command

func (*UserHandler) Validate

func (h *UserHandler) Validate(cmd string, args *common.CommandArgs) error

Validate checks if the arguments are valid for the command

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL