Help us shape the future of Go! Take the 2026 Go Developer Survey

adminapp

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	Options
	// contains filtered or unexported fields
}

func Must

func Must(opts Options) *App

func NewApp

func NewApp(opts Options) (*App, error)

func (*App) AdminAuth

func (a *App) AdminAuth() *adminservice.Service

func (*App) ComposeFileURL

func (a *App) ComposeFileURL(raw string) string

func (*App) ComposeFileURLFallback

func (a *App) ComposeFileURLFallback(primary string, fallback string) string

func (*App) Enabled

func (a *App) Enabled(key string) bool

func (*App) Env

func (a *App) Env() string

func (*App) EventStream

func (a *App) EventStream() eventstream.EventStream

func (*App) HTTPManager

func (a *App) HTTPManager() *goinertia.Inertia

func (*App) InTransaction

func (a *App) InTransaction(ctx context.Context, fn func(context.Context) error) error

func (*App) IsProduction

func (a *App) IsProduction() bool

func (*App) Logger

func (a *App) Logger() logger.Logger

func (*App) NativeCSRFToken added in v0.13.0

func (a *App) NativeCSRFToken(c fiber.Ctx) (string, error)

NativeCSRFToken issues or refreshes native session-bound CSRF for standalone authenticated pages. The ordinary Inertia write middleware still validates it.

func (*App) Outbox

func (a *App) Outbox() OutboxPutter

func (*App) PermissionDefinitions

func (a *App) PermissionDefinitions() []integrationroles.PermissionDefinition

PermissionDefinitions returns a detached snapshot of the runtime permission catalog.

func (*App) PermissionGuard

func (a *App) PermissionGuard() PermissionGuard

func (*App) RolesService

func (a *App) RolesService() RolesService

func (*App) Session

func (a *App) Session() *session.Store

func (*App) SetCapabilities

func (a *App) SetCapabilities(values map[string]bool)

func (*App) SetCommandTransaction

func (a *App) SetCommandTransaction(fn func(context.Context, func(context.Context) error) error)

func (*App) SetNativeCSRFTokenProvider added in v0.13.0

func (a *App) SetNativeCSRFTokenProvider(provider goinertia.CSRFTokenProvider)

SetNativeCSRFTokenProvider binds the same provider used by Inertia rendering.

func (*App) SetPermissionDefinitions

func (a *App) SetPermissionDefinitions(definitions []integrationroles.PermissionDefinition)

SetPermissionDefinitions extends the runtime permission catalog with host-owned definitions.

func (*App) SetUsersFeatureDependencies

func (a *App) SetUsersFeatureDependencies(users UserRepo, subjects SubjectEmailStore)

SetUsersFeatureDependencies stores optional dependencies for the users feature.

func (*App) TxManager

func (a *App) TxManager() outbox.StoragePgsqlTxManager

func (*App) UsersFeatureRepo

func (a *App) UsersFeatureRepo() UserRepo

UsersFeatureRepo returns the optional users feature repository.

func (*App) UsersFeatureSubjects

func (a *App) UsersFeatureSubjects() SubjectEmailStore

UsersFeatureSubjects returns the optional users feature canonical subject store.

type OptOptionsSetter

type OptOptionsSetter func(o *Options)

func WithFilesBucket

func WithFilesBucket(opt string) OptOptionsSetter

type Options

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

func NewOptions

func NewOptions(
	httpManager *goinertia.Inertia,
	permissionGuard PermissionGuard,
	rolesService RolesService,
	adminAuth *adminservice.Service,
	session *session.Store,
	eventStream eventstream.EventStream,
	outbox OutboxPutter,
	txManager outbox.StoragePgsqlTxManager,
	logger logger.Logger,
	env string,
	filesBaseURL string,
	options ...OptOptionsSetter,
) Options

func (*Options) Validate

func (o *Options) Validate() error

type OutboxPutter

type OutboxPutter interface {
	Put(ctx context.Context, name, payload string, availableAt time.Time) (outbox.JobID, error)
}

type PermissionGuard

type PermissionGuard interface {
	AdminGuard(key integrationroles.PermissionKey, opts ...integrationroles.PermissionGuardOption) fiber.Handler
}

type RolesService

type RolesService interface {
	IsAdoptedDetachRole(ctx context.Context, adminAuthID int64, adminID int64, roleID int64) (bool, error)
	IsSuperAdmin(ctx context.Context, adminID int64) bool
	GetRolesAdmin(ctx context.Context, adminID int64) ([]integrationroles.Role, error)
	GetPermissions(ctx context.Context, roles []integrationroles.Role) (map[int64]map[int64]integrationroles.Permission, error)
	AdminGuardCheck(
		ctx context.Context,
		adminID int64,
		key integrationroles.PermissionKey,
		opts ...integrationroles.PermissionGuardOption,
	) bool
	AdminCan(
		ctx context.Context,
		adminID int64,
		domain integrationroles.PermissionDomain,
		action integrationroles.PermissionAction,
	) bool
}

type SubjectEmailStore

type SubjectEmailStore interface {
	UpdateBasicProfile(
		ctx context.Context,
		subjectID goauth.SubjectID,
		profile goauth.BasicProfile,
	) (goauth.Account, error)
	RequestEmailChange(ctx context.Context, subjectID goauth.SubjectID, newEmail string) error
	SetSubjectStatus(
		ctx context.Context,
		subjectID goauth.SubjectID,
		status goauth.SubjectStatus,
	) (goauth.Subject, error)
}

SubjectEmailStore updates canonical subject profile data for the users feature.

type UserRepo

type UserRepo interface {
	GetList(ctx context.Context, filters datagrid.Filtered) ([]integrationroles.Profile, int, error)
	GetByID(ctx context.Context, id int64) (integrationroles.Profile, error)
	Update(ctx context.Context, id int64, user integrationroles.Profile) error
	SoftDeleteByID(ctx context.Context, id int64) error
	RestoreByID(ctx context.Context, id int64) error
}

UserRepo is the optional repository contract consumed by the users feature.

Directories

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

Jump to

Keyboard shortcuts

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