fix: authorize super admins by dynamic highest rank
Remote Build and Deploy / deploy (push) Successful in 42s

This commit is contained in:
Simo committed 2026-07-11 22:35:40 +02:00
1 parent bb847176ad
commit f08e56cf53
10 files changed
+173 -65

No files matched your search

+4 -4
View File
@@ -2,13 +2,13 @@ import { describe, expect, it } from "vitest";
import { shouldRedirectAdminRequest } from "./proxy-access";
describe("shouldRedirectAdminRequest", () => {
it("redirects anonymous and non-staff admin requests before rendering", () => {
it("redirects anonymous admin requests before rendering", () => {
expect(shouldRedirectAdminRequest("/admin", null)).toBe(true);
expect(shouldRedirectAdminRequest("/admin/tickets", { rank: 1 })).toBe(true);
});
it("allows staff admin requests and never affects public routes", () => {
expect(shouldRedirectAdminRequest("/admin/permissions", { rank: 7 })).toBe(false);
it("defers every authenticated rank to database authorization", () => {
expect(shouldRedirectAdminRequest("/admin/permissions", { rank: 1 })).toBe(false);
expect(shouldRedirectAdminRequest("/admin/permissions", { rank: 2000 })).toBe(false);
expect(shouldRedirectAdminRequest("/news", null)).toBe(false);
});
});