middleware

package
v0.0.0-...-d625e3b Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextKeyUser  contextKey = "user"
	ContextKeyFlash contextKey = "flash"
)
View Source
const (
	OwnerTypeKey contextKey = "ownerType"
	OwnerIDKey   contextKey = "ownerID"
)

Variables

This section is empty.

Functions

func Auth

func Auth(authService services.AuthService) func(http.Handler) http.Handler

func GetFlashFromContext

func GetFlashFromContext(r *http.Request) *services.FlashMessage

func GetOwnerID

func GetOwnerID(ctx context.Context) (int64, bool)

func GetUserFromContext

func GetUserFromContext(r *http.Request) *models.User

func InjectFlash

func InjectFlash(flashService services.FlashService) func(http.Handler) http.Handler

func InjectUser

func InjectUser(authService services.AuthService) func(http.Handler) http.Handler

func StaticFileServer

func StaticFileServer(fileServer http.Handler) func(http.Handler) http.Handler

Types

type OwnerType

type OwnerType string
const (
	OwnerTypeUser OwnerType = "user"
	OwnerTypeOrg  OwnerType = "org"
)

func GetOwnerType

func GetOwnerType(ctx context.Context) (OwnerType, bool)

Jump to

Keyboard shortcuts

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