refactor: refs #4074 accept array
gitea/salix-front/pipeline/pr-dev There was a failure building this commit Details

This commit is contained in:
Jorge Penadés 2024-09-09 12:28:14 +02:00
parent 803ce3b909
commit 6438f36eca
3 changed files with 5 additions and 3 deletions

View File

@ -17,7 +17,6 @@ export function useAcl() {
} }
function hasAny(acls) { function hasAny(acls) {
if (!Array.isArray(acls)) acls = [acls];
for (const acl of acls) { for (const acl of acls) {
let { model, props, accessType } = acl; let { model, props, accessType } = acl;
const modelAcls = state.getAcls().value[model]; const modelAcls = state.getAcls().value[model];

View File

@ -284,7 +284,9 @@ const showBalancePdf = ({ id }) => {
> >
<VnInput <VnInput
v-model="scope.value" v-model="scope.value"
:disable="!hasAny('Receipt','*', 'WRITE')" :disable="
!hasAny([{ model: 'Receipt', props: '*', accessType: 'WRITE' }])
"
@keypress.enter="scope.set" @keypress.enter="scope.set"
autofocus autofocus
/> />

View File

@ -195,7 +195,8 @@ async function cloneInvoice() {
push({ path: `/invoice-in/${data.id}/summary` }); push({ path: `/invoice-in/${data.id}/summary` });
} }
const canEditProp = (prop) => hasAny('InvoiceIn', prop, 'WRITE'); const canEditProp = (props) =>
hasAny([{ model: 'InvoiceIn', props, accessType: 'WRITE' }]);
const isAgricultural = () => { const isAgricultural = () => {
if (!config.value) return false; if (!config.value) return false;