refactor: move variable out of function
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 5s
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 5s
This commit is contained in:
parent
5e76c4d50d
commit
d880e1a1c5
1 changed files with 62 additions and 61 deletions
|
|
@ -232,11 +232,6 @@ export function isRoleInclude(role2check: string[]): boolean {
|
|||
return isIncluded;
|
||||
}
|
||||
|
||||
export function canAccess(
|
||||
menu: string,
|
||||
action: 'edit' | 'view' = 'view',
|
||||
): boolean {
|
||||
// uma_authorization = all roles
|
||||
const allRoles = [
|
||||
'head_of_admin',
|
||||
'admin',
|
||||
|
|
@ -297,6 +292,12 @@ export function canAccess(
|
|||
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() ?? [];
|
||||
if (roles.includes('system')) return true;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue