RezinaLMS-BackEnd/internal/web_server/handlers/team_invitation_guard.go
2026-10-19 17:59:34 +03:00

18 lines
408 B
Go

package handlers
import (
"Rezina-Backend/internal/domain"
"github.com/gofiber/fiber/v2"
)
func requireSuperAdminForTeamInvitation(c *fiber.Ctx) error {
role, ok := c.Locals("role").(domain.Role)
if !ok || role != domain.RoleSuperAdmin {
return c.Status(fiber.StatusForbidden).JSON(domain.ErrorResponse{
Message: "Only super administrators can send team email invitations",
})
}
return nil
}