refactor: enhance role-based access checks in TreeComponent and MainPage components
Some checks failed
Spell Check / Spell Check with Typos (push) Failing after 6s

This commit is contained in:
puriphatt 2025-07-02 15:53:20 +07:00
parent 8799799214
commit 701b90d89a
2 changed files with 29 additions and 3 deletions

View file

@ -123,7 +123,13 @@ defineEmits<{
v-if="
node.isHeadOffice &&
typeTree === 'branch' &&
isRoleInclude(['head_of_admin', 'admin', 'system'])
isRoleInclude([
'system',
'head_of_admin',
'admin',
'executive',
'accountant',
])
"
:id="`create-sub-branch-btn-${node.name}`"
@click.stop="$emit('create', node)"

View file

@ -10,7 +10,7 @@ import type { QTableProps, QTableSlots } from 'quasar';
import { resetScrollBar } from 'src/stores/utils';
import useBranchStore from 'stores/branch';
import useFlowStore from 'stores/flow';
import { isRoleInclude } from 'stores/utils';
import { isRoleInclude, canAccess } from 'stores/utils';
import {
BranchWithChildren,
BranchCreate,
@ -1050,7 +1050,7 @@ watch(currentHq, () => {
{{ $t('branch.allBranch') }}
</div>
<q-btn
v-if="isRoleInclude(['head_of_admin', 'admin', 'system'])"
v-if="isRoleInclude(['system'])"
round
flat
size="md"
@ -1561,6 +1561,16 @@ watch(currentHq, () => {
</q-td>
<q-td>
<KebabAction
v-if="
isRoleInclude([
'system',
'head_of_admin',
'admin',
'executive',
'accountant',
]) ||
(canAccess('branch') && currentHq.id)
"
:status="props.row.status"
:idName="props.row.name"
@view="
@ -1702,6 +1712,16 @@ watch(currentHq, () => {
>
<template v-slot:action>
<KebabAction
v-if="
isRoleInclude([
'system',
'head_of_admin',
'admin',
'executive',
'accountant',
]) ||
(canAccess('branch') && currentHq.id)
"
:status="props.row.status"
:idName="props.row.name"
@view="