fix(housekeeping): avoid ase preview self-redirect
This commit is contained in:
1 parent
f72a2b6c74
commit
a9bdd6bd5d
8 files changed
+31
-26
No files matched your search
@@ -14,5 +14,10 @@ export default async function AdminNextPage() {
|
|||||||
|
|
||||||
if (!firstVisibleDomain) notFound();
|
if (!firstVisibleDomain) notFound();
|
||||||
|
|
||||||
redirect(toHousekeepingHref(firstVisibleDomain.canonicalHref, "preview"));
|
const previewHref = toHousekeepingHref(
|
||||||
|
firstVisibleDomain.canonicalHref,
|
||||||
|
"preview",
|
||||||
|
);
|
||||||
|
|
||||||
|
redirect(previewHref === "/ase-next" ? "/ase-next/operations" : previewHref);
|
||||||
}
|
}
|
||||||
@@ -407,13 +407,15 @@ describe("/ase-next first visible domain", () => {
|
|||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
it("redirects an administrator to Operations in locked registry order", async () => {
|
it("redirects an administrator away from the Operations preview root", async () => {
|
||||||
routeMocks.getHousekeepingCapabilityContext.mockResolvedValue(
|
routeMocks.getHousekeepingCapabilityContext.mockResolvedValue(
|
||||||
capabilityContext([PERMS.ADMIN_DASHBOARD, PERMS.USERS_VIEW]),
|
capabilityContext([PERMS.ADMIN_DASHBOARD, PERMS.USERS_VIEW]),
|
||||||
);
|
);
|
||||||
|
|
||||||
await expect(AdminNextPage()).rejects.toThrow("NEXT_REDIRECT:/ase-next");
|
await expect(AdminNextPage()).rejects.toThrow(
|
||||||
expect(routeMocks.redirect).toHaveBeenCalledWith("/ase-next");
|
"NEXT_REDIRECT:/ase-next/operations",
|
||||||
|
);
|
||||||
|
expect(routeMocks.redirect).toHaveBeenCalledWith("/ase-next/operations");
|
||||||
expect(routeMocks.getHousekeepingCapabilityContext).toHaveBeenCalledTimes(
|
expect(routeMocks.getHousekeepingCapabilityContext).toHaveBeenCalledTimes(
|
||||||
1,
|
1,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -31,8 +31,7 @@ describe("contentMigrationEntries", () => {
|
|||||||
expect(
|
expect(
|
||||||
contentMigrationEntries.every(
|
contentMigrationEntries.every(
|
||||||
(row) =>
|
(row) =>
|
||||||
row.targetPath === null ||
|
row.targetPath === null || row.targetPath.startsWith("/ase/content/"),
|
||||||
row.targetPath.startsWith("/admin/content/"),
|
|
||||||
),
|
),
|
||||||
).toBe(true);
|
).toBe(true);
|
||||||
});
|
});
|
||||||
@@ -45,23 +44,23 @@ describe("contentMigrationEntries", () => {
|
|||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
legacyPath: "/admin/articles/:id",
|
legacyPath: "/admin/articles/:id",
|
||||||
targetPath: "/admin/content/editorial/articles/:id",
|
targetPath: "/ase/content/editorial/articles/:id",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
legacyPath: "/admin/ads/:id",
|
legacyPath: "/admin/ads/:id",
|
||||||
targetPath: "/admin/content/media/ads/:id",
|
targetPath: "/ase/content/media/ads/:id",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
legacyPath: "/admin/events/:id",
|
legacyPath: "/admin/events/:id",
|
||||||
targetPath: "/admin/content/engagement/events/:id",
|
targetPath: "/ase/content/engagement/events/:id",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
legacyPath: "/admin/polls/:id",
|
legacyPath: "/admin/polls/:id",
|
||||||
targetPath: "/admin/content/engagement/polls/:id",
|
targetPath: "/ase/content/engagement/polls/:id",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
legacyPath: "/admin/help-questions/:id",
|
legacyPath: "/admin/help-questions/:id",
|
||||||
targetPath: "/admin/content/help/questions/:id",
|
targetPath: "/ase/content/help/questions/:id",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,8 +27,7 @@ describe("economyMigrationEntries", () => {
|
|||||||
expect(
|
expect(
|
||||||
economyMigrationEntries.every(
|
economyMigrationEntries.every(
|
||||||
(row) =>
|
(row) =>
|
||||||
row.targetPath === null ||
|
row.targetPath === null || row.targetPath.startsWith("/ase/economy/"),
|
||||||
row.targetPath.startsWith("/admin/economy/"),
|
|
||||||
),
|
),
|
||||||
).toBe(true);
|
).toBe(true);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ describe("hotelMigrationEntries", () => {
|
|||||||
expect(
|
expect(
|
||||||
hotelMigrationEntries.every(
|
hotelMigrationEntries.every(
|
||||||
(row) =>
|
(row) =>
|
||||||
row.targetPath === null || row.targetPath.startsWith("/admin/hotel/"),
|
row.targetPath === null || row.targetPath.startsWith("/ase/hotel/"),
|
||||||
),
|
),
|
||||||
).toBe(true);
|
).toBe(true);
|
||||||
});
|
});
|
||||||
@@ -39,27 +39,27 @@ describe("hotelMigrationEntries", () => {
|
|||||||
).toEqual([
|
).toEqual([
|
||||||
{
|
{
|
||||||
legacyPath: "/admin/rooms",
|
legacyPath: "/admin/rooms",
|
||||||
targetPath: "/admin/hotel/rooms",
|
targetPath: "/ase/hotel/rooms",
|
||||||
decision: "REBUILD",
|
decision: "REBUILD",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
legacyPath: "/admin/rooms/:id",
|
legacyPath: "/admin/rooms/:id",
|
||||||
targetPath: "/admin/hotel/rooms/:id",
|
targetPath: "/ase/hotel/rooms/:id",
|
||||||
decision: "MERGE",
|
decision: "MERGE",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
legacyPath: "/admin/rooms/:id/furni",
|
legacyPath: "/admin/rooms/:id/furni",
|
||||||
targetPath: "/admin/hotel/rooms/:id/furni",
|
targetPath: "/ase/hotel/rooms/:id/furni",
|
||||||
decision: "REBUILD",
|
decision: "REBUILD",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
legacyPath: "/admin/rooms/edit/:id",
|
legacyPath: "/admin/rooms/edit/:id",
|
||||||
targetPath: "/admin/hotel/rooms/:id",
|
targetPath: "/ase/hotel/rooms/:id",
|
||||||
decision: "MERGE",
|
decision: "MERGE",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
legacyPath: "/admin/rooms/show/:id",
|
legacyPath: "/admin/rooms/show/:id",
|
||||||
targetPath: "/admin/hotel/rooms/:id",
|
targetPath: "/ase/hotel/rooms/:id",
|
||||||
decision: "MERGE",
|
decision: "MERGE",
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ describe("operationsMigrationEntries", () => {
|
|||||||
legacyPath: "/admin",
|
legacyPath: "/admin",
|
||||||
sourceFile: "src/app/admin/page.tsx",
|
sourceFile: "src/app/admin/page.tsx",
|
||||||
targetDomain: "operations",
|
targetDomain: "operations",
|
||||||
targetPath: "/admin/work",
|
targetPath: "/ase",
|
||||||
decision: "REBUILD",
|
decision: "REBUILD",
|
||||||
capabilities: { read: [PERMS.ADMIN_DASHBOARD], mutate: [] },
|
capabilities: { read: [PERMS.ADMIN_DASHBOARD], mutate: [] },
|
||||||
dependencies: {
|
dependencies: {
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ describe("peopleMigrationEntries", () => {
|
|||||||
expect(modRows).toHaveLength(13);
|
expect(modRows).toHaveLength(13);
|
||||||
expect(modRows.every((row) => row.decision === "MERGE")).toBe(true);
|
expect(modRows.every((row) => row.decision === "MERGE")).toBe(true);
|
||||||
expect(
|
expect(
|
||||||
modRows.every((row) => row.targetPath?.startsWith("/admin/people/")),
|
modRows.every((row) => row.targetPath?.startsWith("/ase/people/")),
|
||||||
).toBe(true);
|
).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ describe("systemMigrationEntries", () => {
|
|||||||
expect(systemMigrationEntries).toContainEqual(
|
expect(systemMigrationEntries).toContainEqual(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
legacyPath: "/admin/permissions",
|
legacyPath: "/admin/permissions",
|
||||||
targetPath: "/admin/system/access/permissions",
|
targetPath: "/ase/system/access/permissions",
|
||||||
decision: expect.not.stringMatching("REMOVE"),
|
decision: expect.not.stringMatching("REMOVE"),
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
@@ -75,10 +75,10 @@ describe("systemMigrationEntries", () => {
|
|||||||
|
|
||||||
it("uses only the approved System target roots", () => {
|
it("uses only the approved System target roots", () => {
|
||||||
const allowedRoots = [
|
const allowedRoots = [
|
||||||
"/admin/system/access",
|
"/ase/system/access",
|
||||||
"/admin/system/configuration",
|
"/ase/system/configuration",
|
||||||
"/admin/system/observability",
|
"/ase/system/observability",
|
||||||
"/admin/system/operations",
|
"/ase/system/operations",
|
||||||
];
|
];
|
||||||
|
|
||||||
expect(
|
expect(
|
||||||
|
|||||||
Reference in new issue
Block a user