user

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateUserRequest

type CreateUserRequest struct {
	AccessKey string
	SecretKey string
	Status    iam.UserStatus
}

CreateUserRequest represents a request to create a new user

type Repository

type Repository interface {
	GetUserByAccessKey(ctx context.Context, accessKey string) (*metadata.User, error)
	CreateOrUpdateUser(ctx context.Context, user *metadata.User) error
	GetUser(ctx context.Context, userUID uuid.UUID) (*metadata.User, error)
	GetGroupNamesForUser(ctx context.Context, userUID uuid.UUID) ([]string, error)
	RemoveUserFromGroup(ctx context.Context, groupName string, userUID uuid.UUID) error
	DeleteUser(ctx context.Context, userUID uuid.UUID) error
	ListUsers(ctx context.Context) ([]uuid.UUID, error)
	GetPolicy(ctx context.Context, name string) (*metadata.Policy, error)
}

Repository is the persistence interface required by the user Service.

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service provides user management operations

func NewService

func NewService(metadataManager Repository, authManager *auth.Authenticator) *Service

NewService creates a new user service

func (*Service) AttachPolicy

func (s *Service) AttachPolicy(ctx context.Context, userUID uuid.UUID, policyName string) error

AttachPolicy attaches a policy to a user (idempotent).

func (*Service) Create

func (s *Service) Create(ctx context.Context, req *CreateUserRequest) (*iam.User, error)

Create creates a new user with validation

func (*Service) Delete

func (s *Service) Delete(ctx context.Context, userUID uuid.UUID) error

Delete deletes a user by UUID, removing them from all groups first.

func (*Service) DetachPolicy

func (s *Service) DetachPolicy(ctx context.Context, userUID uuid.UUID, policyName string) error

DetachPolicy detaches a policy from a user.

func (*Service) Get

func (s *Service) Get(ctx context.Context, userUID uuid.UUID) (*iam.User, error)

Get retrieves a user by UUID.

func (*Service) GetByAccessKey

func (s *Service) GetByAccessKey(ctx context.Context, accessKey string) (*iam.User, error)

GetByAccessKey retrieves a user by access key. This method exists for external API boundaries (e.g. the MinIO-compatible HTTP API) where access keys are the wire-format identifier. Internal code should prefer Get(uuid).

func (*Service) GetGroups

func (s *Service) GetGroups(ctx context.Context, uid uuid.UUID) ([]string, error)

func (*Service) List

func (s *Service) List(ctx context.Context) ([]uuid.UUID, error)

List returns all user UUIDs.

func (*Service) Update

func (s *Service) Update(ctx context.Context, userUID uuid.UUID, req *UpdateUserRequest) (*iam.User, error)

Update updates mutable fields of an existing user.

type UpdateUserRequest

type UpdateUserRequest struct {
	SecretKey        *string
	Status           *iam.UserStatus
	AttachedPolicies *[]string
}

UpdateUserRequest represents a request to update an existing user

Directories

Path Synopsis
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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