auth

package
v0.0.0-...-f828163 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AttachExtractor

func AttachExtractor(middleware func(c *fiber.Ctx, extractor ExtractID) error, extractor ExtractID) fiber.Handler

Types

type AuthMiddlewareHandler

type AuthMiddlewareHandler struct {
	// contains filtered or unexported fields
}

func (*AuthMiddlewareHandler) Authorize

func (m *AuthMiddlewareHandler) Authorize(requiredPermissions ...permission.Permission) fiber.Handler

func (*AuthMiddlewareHandler) ClubAuthorizeById

func (m *AuthMiddlewareHandler) ClubAuthorizeById(c *fiber.Ctx, extractor ExtractID) error

Authorizes admins of the specific club to make this request, skips check if super user

func (*AuthMiddlewareHandler) EventAuthorizeById

func (m *AuthMiddlewareHandler) EventAuthorizeById(c *fiber.Ctx, extractor ExtractID) error

Authorizes admins of the host club of this event to make this request, skips check if super user

func (*AuthMiddlewareHandler) UserAuthorizeById

func (m *AuthMiddlewareHandler) UserAuthorizeById(c *fiber.Ctx) error

type AuthMiddlewareService

type AuthMiddlewareService interface {
	ClubAuthorizeById(c *fiber.Ctx, extractor ExtractID) error
	UserAuthorizeById(c *fiber.Ctx) error
	EventAuthorizeById(c *fiber.Ctx, extractor ExtractID) error
	Authorize(requiredPermissions ...permission.Permission) fiber.Handler
}

func New

func New(db *gorm.DB, validate *validator.Validate) AuthMiddlewareService

type ExtractID

type ExtractID func(*fiber.Ctx) (*uuid.UUID, error)

func ExtractFromBody

func ExtractFromBody(key string) ExtractID

func ExtractFromParamIntoQuery

func ExtractFromParamIntoQuery(param string, db *gorm.DB, query QueryFn) ExtractID

func ExtractFromParams

func ExtractFromParams(param string) ExtractID

func ExtractFromQuery

func ExtractFromQuery(db *gorm.DB, id uuid.UUID, query QueryFn) ExtractID

func FromExtractFromParamIntoQuery

func FromExtractFromParamIntoQuery(param string, db *gorm.DB, query QueryFn) ExtractID

type QueryFn

type QueryFn func(*gorm.DB, uuid.UUID) (*uuid.UUID, error)

Jump to

Keyboard shortcuts

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