middleware

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(repo db.UserRepo)

Init sets the shared user repository for middleware

func RequireAdmin

func RequireAdmin(next http.HandlerFunc) http.HandlerFunc

RequireAdmin allows only admin users

func RequireLogin

func RequireLogin(next http.HandlerFunc) http.HandlerFunc

RequireLogin ensures the user is logged in

func RequireRole

func RequireRole(next http.HandlerFunc, roles ...string) http.HandlerFunc

RequireRole returns a handler that only allows users with given roles

func RequireRoleWithLogin

func RequireRoleWithLogin(next http.HandlerFunc, roles ...string) http.HandlerFunc

RequireRoleWithLogin ensures the user is logged in and has one of the specified roles

Types

This section is empty.

Jump to

Keyboard shortcuts

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