refactor(view access): if role [] then allow them to see it

This commit is contained in:
2025-03-19 17:59:22 -05:00
parent e597968777
commit e17b8e7bbe
2 changed files with 2 additions and 1 deletions

View File

@@ -15,7 +15,7 @@ const items = [
title: "One Click Print", title: "One Click Print",
url: "/ocp", url: "/ocp",
icon: Printer, icon: Printer,
role: ["viwer"], role: [],
module: "ocp", module: "ocp",
active: true, active: true,
}, },

View File

@@ -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 { export function hasPageAccess(user: User | null, role: any, module_id: string): boolean {
if (role.length === 0) return true;
if (!user) return false; if (!user) return false;
// get only the module in the user profile // get only the module in the user profile