middleware

package
v0.0.0-...-529d850 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Auth

func Auth(acceptableRoles ...Role) func(c *gin.Context)

func ErrorHandler

func ErrorHandler(c *gin.Context)

func EventActionPreProcess

func EventActionPreProcess(c *gin.Context)

Get event and put to context, and set role to member if event's member field equals to id. You are supposed to call this before any route that performs event action.

func Logger

func Logger(c *gin.Context)

func StepDown

func StepDown(role string) func(c *gin.Context)

admin is also member

Types

type AuthContextUser

type AuthContextUser struct {
	UserInfo service.FetchUserInfoResponse
	Role     []string
}

type Role

type Role string
const (
	Member Role = "member"
	Admin  Role = "admin"
)

Jump to

Keyboard shortcuts

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