From e17b8e7bbe94c25c1bd3414b1db31191c87553d6 Mon Sep 17 00:00:00 2001 From: Blake Matthes Date: Wed, 19 Mar 2025 17:59:22 -0500 Subject: [PATCH] refactor(view access): if role [] then allow them to see it --- frontend/src/components/layout/side-components/production.tsx | 2 +- frontend/src/utils/userAccess.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/components/layout/side-components/production.tsx b/frontend/src/components/layout/side-components/production.tsx index 5316b2c..d55bc97 100644 --- a/frontend/src/components/layout/side-components/production.tsx +++ b/frontend/src/components/layout/side-components/production.tsx @@ -15,7 +15,7 @@ const items = [ title: "One Click Print", url: "/ocp", icon: Printer, - role: ["viwer"], + role: [], module: "ocp", active: true, }, diff --git a/frontend/src/utils/userAccess.ts b/frontend/src/utils/userAccess.ts index 5977769..4d95af0 100644 --- a/frontend/src/utils/userAccess.ts +++ b/frontend/src/utils/userAccess.ts @@ -13,6 +13,7 @@ export function hasAccess(user: User | null, moduleName: string | null, modules: } export function hasPageAccess(user: User | null, role: any, module_id: string): boolean { + if (role.length === 0) return true; if (!user) return false; // get only the module in the user profile