forked from verdnatura/salix-front
feat: refs #4074 useAcl in vnSelectDialog
This commit is contained in:
parent
53aec24790
commit
6c3c03722f
|
@ -27,17 +27,17 @@ const $props = defineProps({
|
|||
});
|
||||
|
||||
const role = useRole();
|
||||
const acl = useAcl()
|
||||
const acl = useAcl();
|
||||
const showForm = ref(false);
|
||||
|
||||
const isAllowedToCreate = computed(() => {
|
||||
if ($props.acls.length) console.log(acl.hasAny($props.acls));
|
||||
return role.hasAny($props.rolesAllowedToCreate);
|
||||
const hasMissingAcl = $props.acls.some(
|
||||
(x) => !acl.hasAny(x.model, x.props, x.accessType)
|
||||
);
|
||||
const hasRequiredRole = role.hasAny($props.rolesAllowedToCreate);
|
||||
if ($props.acls.length) return !hasMissingAcl;
|
||||
return hasRequiredRole;
|
||||
});
|
||||
|
||||
const toggleForm = () => {
|
||||
showForm.value = !showForm.value;
|
||||
};
|
||||
</script>
|
||||
|
||||
<template>
|
||||
|
@ -48,7 +48,7 @@ const toggleForm = () => {
|
|||
>
|
||||
<template v-if="isAllowedToCreate" #append>
|
||||
<QIcon
|
||||
@click.stop.prevent="toggleForm()"
|
||||
@click.stop.prevent="showForm = true"
|
||||
:name="actionIcon"
|
||||
:size="actionIcon === 'add' ? 'xs' : 'sm'"
|
||||
:class="['default-icon', { '--add-icon': actionIcon === 'add' }]"
|
||||
|
|
Loading…
Reference in New Issue