0
0
Fork 0

chore: refs #4074 wip replace useRole for useAcl

This commit is contained in:
Jorge Penadés 2024-08-01 09:15:35 +02:00
parent 287abcf90c
commit 351c2a07dc
5 changed files with 17 additions and 18 deletions

View File

@ -115,8 +115,8 @@ watch(
);
watch(
() => [props.url, props.filter],
([url, filter]) => fetch({ url, filter })
() => [props.url, props.filter, props.userParams],
([url, filter, userParams]) => fetch({ url, filter, userParams })
);
const addFilter = async (filter, params) => {

View File

@ -13,7 +13,7 @@ import AccountCreate from './AccountCreate.vue';
import { useSummaryDialog } from 'src/composables/useSummaryDialog';
import { useStateStore } from 'stores/useStateStore';
import { useRole } from 'src/composables/useRole';
import { useAcl } from 'src/composables/useAcl';
import { QDialog } from 'quasar';
const stateStore = useStateStore();
@ -21,7 +21,7 @@ const router = useRouter();
const { t } = useI18n();
const { viewSummary } = useSummaryDialog();
const accountCreateDialogRef = ref(null);
const showNewUserBtn = computed(() => useRole().hasAny(['itManagement']));
const showNewUserBtn = computed(() => useAcl().hasAny('Account', '*', 'WRITE'));
const filter = {
fields: ['id', 'nickname', 'name', 'role'],

View File

@ -2,7 +2,7 @@
import { computed, onBeforeMount, ref } from 'vue';
import { useI18n } from 'vue-i18n';
import { useRoute } from 'vue-router';
import { useRole } from 'src/composables/useRole';
import { useAcl } from 'src/composables/useAcl';
import axios from 'axios';
import { useQuasar } from 'quasar';
@ -25,7 +25,7 @@ import InvoiceOutDescriptorProxy from 'src/pages/InvoiceOut/Card/InvoiceOutDescr
const { openConfirmationModal } = useVnConfirm();
const { sendEmail } = usePrintService();
const { t } = useI18n();
const { hasAny } = useRole();
const { hasAny } = useAcl();
const session = useSession();
const tokenMultimedia = session.getTokenMultimedia();
@ -317,7 +317,7 @@ const showBalancePdf = ({ id }) => {
>
<VnInput
v-model="scope.value"
:disable="!hasAny(['administrative'])"
:disable="!hasAny('Receipt','*', 'WRITE')"
@keypress.enter="scope.set"
autofocus
/>

View File

@ -5,7 +5,7 @@ import { useI18n } from 'vue-i18n';
import { useQuasar } from 'quasar';
import axios from 'axios';
import { toCurrency, toDate } from 'src/filters';
import { useRole } from 'src/composables/useRole';
import { useAcl } from 'src/composables/useAcl';
import { downloadFile } from 'src/composables/downloadFile';
import { useArrayData } from 'src/composables/useArrayData';
import { usePrintService } from 'composables/usePrintService';
@ -24,7 +24,7 @@ const $props = defineProps({ id: { type: Number, default: null } });
const { push, currentRoute } = useRouter();
const quasar = useQuasar();
const { hasAny } = useRole();
const { hasAny } = useAcl();
const { t } = useI18n();
const { openReport, sendEmail } = usePrintService();
const arrayData = useArrayData();
@ -195,10 +195,9 @@ async function cloneInvoice() {
push({ path: `/invoice-in/${data.id}/summary` });
}
const isAdministrative = () => hasAny(['administrative']);
const canEditProp = (prop) => hasAny('InvoiceIn', prop, 'WRITE');
const isAgricultural = () => {
console.error(config);
if (!config.value) return false;
return (
invoiceIn.value?.supplier?.sageFarmerWithholdingFk ===
@ -284,7 +283,7 @@ const createInvoiceInCorrection = async () => {
<InvoiceInToBook>
<template #content="{ book }">
<QItem
v-if="!entity?.isBooked && isAdministrative()"
v-if="!entity?.isBooked && canEditProp('toBook')"
v-ripple
clickable
@click="book(entityId)"
@ -294,7 +293,7 @@ const createInvoiceInCorrection = async () => {
</template>
</InvoiceInToBook>
<QItem
v-if="entity?.isBooked && isAdministrative()"
v-if="entity?.isBooked && canEditProp('toUnBook')"
v-ripple
clickable
@click="triggerMenu('unbook')"
@ -304,7 +303,7 @@ const createInvoiceInCorrection = async () => {
</QItemSection>
</QItem>
<QItem
v-if="isAdministrative()"
v-if="canEditProp('deleteById')"
v-ripple
clickable
@click="triggerMenu('delete')"
@ -312,7 +311,7 @@ const createInvoiceInCorrection = async () => {
<QItemSection>{{ t('Delete invoice') }}</QItemSection>
</QItem>
<QItem
v-if="isAdministrative()"
v-if="canEditProp('clone')"
v-ripple
clickable
@click="triggerMenu('clone')"

View File

@ -3,13 +3,13 @@ import { ref, computed } from 'vue';
import { useRoute } from 'vue-router';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
import { useRole } from 'src/composables/useRole';
import { useAcl } from 'src/composables/useAcl';
import FormModel from 'components/FormModel.vue';
import VnSelect from 'src/components/common/VnSelect.vue';
import { useArrayData } from 'src/composables/useArrayData';
import FetchData from 'components/FetchData.vue';
const { hasAny } = useRole();
const { hasAny } = useAcl();
const { t } = useI18n();
const fetchData = ref();
const originaLockerId = ref();
@ -57,7 +57,7 @@ const init = async (data) => {
option-label="code"
option-value="id"
hide-selected
:readonly="!hasAny(['productionBoss', 'hr'])"
:readonly="!hasAny('Worker','__get__locker','READ')"
/>
</template>
</FormModel>