From 6c3c03722f263203f5707f72ca021533e97dd3d4 Mon Sep 17 00:00:00 2001 From: jorgep Date: Fri, 2 Aug 2024 09:37:48 +0200 Subject: [PATCH] feat: refs #4074 useAcl in vnSelectDialog --- src/components/common/VnSelectDialog.vue | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/common/VnSelectDialog.vue b/src/components/common/VnSelectDialog.vue index 6f2be4bfe..0ade82bda 100644 --- a/src/components/common/VnSelectDialog.vue +++ b/src/components/common/VnSelectDialog.vue @@ -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; -};