test(ocme): cycle count intital improvements
This commit is contained in:
@@ -13,15 +13,13 @@ 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 (role.includes("viewer")) return true;
|
||||
if (!user) return false;
|
||||
|
||||
// get only the module in the user profile
|
||||
const userRole = user?.roles.filter((role) => role.module_id === module_id);
|
||||
|
||||
if (role.includes(userRole[0]?.role)) {
|
||||
return true;
|
||||
}
|
||||
if (role.includes(userRole[0]?.role)) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user