This commit is contained in:
Lizandro Guarnizo
2026-05-16 20:01:36 -05:00
parent 4c14f4a641
commit 2b7458b612
8 changed files with 972 additions and 0 deletions
+11
View File
@@ -35,3 +35,14 @@ func PortalUserFromLocals(c *fiber.Ctx) *models.PortalUser {
u, _ := c.Locals("portalUser").(*models.PortalUser)
return u
}
// PortalPartnerOnly permite el acceso solo a usuarios con rol "partner".
func PortalPartnerOnly() fiber.Handler {
return func(c *fiber.Ctx) error {
u := PortalUserFromLocals(c)
if u == nil || u.Rol != "partner" {
return c.Status(fiber.StatusForbidden).JSON(fiber.Map{"error": "Acceso exclusivo para partners"})
}
return c.Next()
}
}