UPDATE: Historian module
All checks were successful
Build and Release / release (push) Successful in 1m20s

This commit is contained in:
2026-04-12 00:35:14 +07:00
parent af76d2a26a
commit 03415782d1
38 changed files with 2759 additions and 231 deletions

View File

@@ -60,3 +60,24 @@ func RequireAllRoles(required ...constants.Role) fiber.Handler {
return c.Next()
}
}
func ForbidRoles(forbidden ...constants.Role) fiber.Handler {
return func(c fiber.Ctx) error {
userRoles, err := getRoles(c)
if err != nil {
return err
}
if len(userRoles) == 0 {
return c.Next()
}
for _, ur := range userRoles {
if slices.Contains(forbidden, ur) {
return fiber.ErrForbidden
}
}
return c.Next()
}
}