middleware

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CasbinAuthorization

func CasbinAuthorization(enforcer *casbin.Enforcer, resource string, action string) gin.HandlerFunc

CasbinAuthorization: evaluate role(obj=resource, act=methodMapping) for each request

func ForInternal

func ForInternal(commonRepo repository.CommonRepository, enforcer *casbin.Enforcer) gin.HandlerFunc

func ForPrivate

func ForPrivate(commonRepo repository.CommonRepository, enforcer *casbin.Enforcer) gin.HandlerFunc

ForPrivate: determine if email is included in admin.emails (not dependent solely on role claims)

func ForPublic

func ForPublic(conf config.BaseConfig) gin.HandlerFunc

func GetUserClaims

func GetUserClaims(c *gin.Context) (*model.JWTClaims, bool)

GetUserClaims is a helper function to get full user claims from context

func GetUserEmail

func GetUserEmail(c *gin.Context) (string, bool)

GetUserEmail is a helper function to get user email from context

func GetUserID

func GetUserID(c *gin.Context) (uint, bool)

GetUserID is a helper function to get user ID from context

func GetUserName

func GetUserName(c *gin.Context) (string, bool)

GetUserName is a helper function to get user name from context

func GetUserRole

func GetUserRole(c *gin.Context) (string, bool)

GetUserRole is a helper function to get user role from context

func GetUserUUID

func GetUserUUID(c *gin.Context) (string, bool)

GetUserUUID is a helper function to get user UUID from context

func LoggerWithConfig

func LoggerWithConfig(conf config.BaseConfig) gin.HandlerFunc

Types

This section is empty.

Jump to

Keyboard shortcuts

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