modelmigration

package
v0.0.0-...-c030021 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2025 License: AGPL-3.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterExport

func RegisterExport(coordinator Coordinator, logger logger.Logger)

RegisterExport registers the export operations with the given coordinator.

func RegisterImport

func RegisterImport(coordinator Coordinator, logger logger.Logger)

RegisterImport registers the import operations with the given coordinator.

Types

type Coordinator

type Coordinator interface {
	// Add adds the given operation to the migration.
	Add(modelmigration.Operation)
}

Coordinator is the interface that is used to add operations to a migration.

type ExportService

type ExportService interface {
	// ReadAllUserAccessForTarget return a slice of user access for all users
	// with access to the given target.
	// An [errors.NotValid] error is returned if the target is not valid. Any
	// errors from the state layer are passed through.
	// An [accesserrors.PermissionNotFound] error is returned if no permissions
	// can be found on the target.
	ReadAllUserAccessForTarget(ctx context.Context, target corepermission.ID) ([]corepermission.UserAccess, error)
	// LastModelLogin will return the last login time of the specified user.
	// The following error types are possible from this function:
	// - [accesserrors.UserNameNotValid] when the username is not valid.
	// - [accesserrors.UserNotFound] when the user cannot be found.
	// - [modelerrors.NotFound] if no model by the given modelUUID exists.
	// - [accesserrors.UserNeverAccessedModel] if there is no record of the user
	// accessing the model.
	LastModelLogin(ctx context.Context, name user.Name, modelUUID coremodel.UUID) (time.Time, error)
}

ExportService provides a subset of the access domain service methods needed for model permissions export.

type ImportService

type ImportService interface {
	// CreatePermission gives the user access per the provided spec.
	// If the user provided does not exist or is marked removed,
	// [accesserrors.PermissionNotFound] is returned.
	// If the user provided exists but is marked disabled,
	// [accesserrors.UserAuthenticationDisabled] is returned.
	// If a permission for the user and target key already exists,
	// [accesserrors.PermissionAlreadyExists] is returned.
	CreatePermission(ctx context.Context, spec corepermission.UserAccessSpec) (corepermission.UserAccess, error)
	// SetLastModelLogin will set the last login time for the user to the given
	// value. The following error types are possible from this function:
	// [accesserrors.UserNameNotValid] when the username supplied is not valid.
	// [accesserrors.UserNotFound] when the user cannot be found.
	// [modelerrors.NotFound] if no model by the given modelUUID exists.
	SetLastModelLogin(ctx context.Context, name user.Name, modelUUID coremodel.UUID, time time.Time) error
}

ImportService provides a subset of the access domain service methods needed for model permissions import.

Jump to

Keyboard shortcuts

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