middleware

package
v0.30.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const MemberIDCtxKey = "memberIDCtx"
View Source
const PubSubMessageCtxKey = "pubSubMessageCtx"

Variables

This section is empty.

Functions

func MustGetMemberIDFromContext

func MustGetMemberIDFromContext(ctx *gin.Context) uuid.UUID

MustGetAdminFromContext returns the member ID from the context.

func MustGetMessageFromContext

func MustGetMessageFromContext(ctx *gin.Context) q.PubSubMessage

MustGetMessageFromContext returns the PubSub message from the context.

func NewMemberCtx

func NewMemberCtx(tenant string, membersClient MembersClient) *memberCtx

func NewPubSubCtx

func NewPubSubCtx(l Locker) *pubSubCtx

func RequireEmailVerified added in v0.27.0

func RequireEmailVerified() gin.HandlerFunc

func RequireIfServiceAccount

func RequireIfServiceAccount(userID string) gin.HandlerFunc

RequireIfServiceAccount returns a middleware that checks if the request is coming from a service account and if the user ID is the same as the one provided.

func RequireSecondFactorPhone added in v0.27.0

func RequireSecondFactorPhone() gin.HandlerFunc

Types

type Locker

type Locker interface {
	TryToLock(ctx context.Context, key string) error
}

type MembersClient

type MembersClient interface {
	HasPermissions(ctx context.Context, tenant string, id uuid.UUID, permissions ...[]string) bool
}

Jump to

Keyboard shortcuts

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