refactor: move variable out of function
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 5s

This commit is contained in:
Methapon2001 2025-07-03 14:53:33 +07:00
parent 5e76c4d50d
commit d880e1a1c5

View file

@ -232,11 +232,6 @@ export function isRoleInclude(role2check: string[]): boolean {
return isIncluded; return isIncluded;
} }
export function canAccess(
menu: string,
action: 'edit' | 'view' = 'view',
): boolean {
// uma_authorization = all roles
const allRoles = [ const allRoles = [
'head_of_admin', 'head_of_admin',
'admin', 'admin',
@ -297,6 +292,12 @@ export function canAccess(
view: allRoles.filter((r) => r !== 'admin'), view: allRoles.filter((r) => r !== 'admin'),
}, },
}; };
export function canAccess(
menu: keyof typeof permissions,
action: 'edit' | 'view' = 'view',
): boolean {
// uma_authorization = all roles
const roles = getRole() ?? []; const roles = getRole() ?? [];
if (roles.includes('system')) return true; if (roles.includes('system')) return true;