middleware

package
v0.0.0-...-8ac9c69 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserCtxKey = contextKey("user")

Functions

func Auth

func Auth(bun *bun.DB) echo.MiddlewareFunc

func WebsocketInitFunc

func WebsocketInitFunc(bun *bun.DB) transport.WebsocketInitFunc

Types

type UserContext

type UserContext struct {
	db.User
	Token string
}

func ForContext

func ForContext(ctx context.Context) *UserContext

ForContext finds the user from the context. REQUIRES Middleware to have run.

func GetUser

func GetUser(ctx context.Context) (*UserContext, error)

GetUser Helper function to get the current user from the context.

func (UserContext) HasPermissionAdmin

func (c UserContext) HasPermissionAdmin() bool

Jump to

Keyboard shortcuts

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