auth

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContextUser key = iota
	ContextRoles
)
View Source
const APIKeyHeader = "ApiKey"

Variables

View Source
var ErrUnauthorized = errors.New("not authorized")

Functions

func GetCurrentUser

func GetCurrentUser(ctx context.Context) *models.User

func IsRole

func IsRole(ctx context.Context, requiredRole models.RoleEnum) bool

func ValidateAdmin

func ValidateAdmin(ctx context.Context) error

func ValidateBot

func ValidateBot(ctx context.Context) error

func ValidateInvite

func ValidateInvite(ctx context.Context) error

func ValidateManageInvites

func ValidateManageInvites(ctx context.Context) error

func ValidateOwner

func ValidateOwner(ctx context.Context, userID uuid.UUID) error

func ValidateRole

func ValidateRole(ctx context.Context, requiredRole models.RoleEnum) error

func ValidateUserOrAdmin

func ValidateUserOrAdmin(ctx context.Context, userID uuid.UUID) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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