package authentication import ( "fmt" "git.devices.local/mawas/golang-api-skeleton/lib/apperrors" "git.devices.local/mawas/golang-api-skeleton/lib/response" "github.com/gin-gonic/gin" ) // Authorized blocks unauthorized requestors func Authorized(c *gin.Context) { var resp response.Envelope userID, exists := c.Get("userID") if !exists { e := apperrors.NewError(apperrors.Unauthorized, "") c.AbortWithStatusJSON(e.GetHTTPStatus(), resp.AppendError(e)) return } fmt.Println("permission check", userID) // TODO add cache perm check here }