Merge branch 'main' of ssh://git.ma-al.com:8822/goc_daniel/b2b into routing-per-role

This commit is contained in:
2026-04-14 13:15:51 +02:00
24 changed files with 357 additions and 338 deletions

View File

@@ -114,26 +114,6 @@ func Authorize() fiber.Handler {
}
}
// RequireAdmin creates admin-only middleware
func RequireAdmin() fiber.Handler {
return func(c fiber.Ctx) error {
originalUserRole, ok := localeExtractor.GetOriginalUserRole(c)
if !ok {
return c.Status(fiber.StatusUnauthorized).JSON(fiber.Map{
"error": "not authenticated",
})
}
if model.CustomerRole(originalUserRole.Name) != model.RoleAdmin {
return c.Status(fiber.StatusForbidden).JSON(fiber.Map{
"error": "admin access required",
})
}
return c.Next()
}
}
// Webdav
func Webdav() fiber.Handler {
authService := authService.NewAuthService()