fix: table permission option not visible for external source

This commit is contained in:
Ramesh Mane
2025-12-03 05:30:55 +00:00
parent e3106c0175
commit 6ca21ed383
2 changed files with 30 additions and 37 deletions

View File

@@ -432,6 +432,24 @@ async function onRename() {
onCancel() onCancel()
} }
const enabledOptions = computed(() => {
return {
tableRename: isUIAllowed('tableRename', { roles: baseRole?.value, source: source.value }),
tableDescriptionEdit: isUIAllowed('tableDescriptionEdit', { roles: baseRole?.value, source: source.value }),
tableDuplicate:
isUIAllowed('tableDuplicate', {
source: source.value,
}) &&
(source.value?.is_meta || source.value?.is_local),
tablePermission:
isTableAndFieldPermissionsEnabled.value &&
isEeUI &&
table.value?.type === 'table' &&
isUIAllowed('tablePermission', { roles: baseRole?.value, source: source.value }),
tableDelete: isUIAllowed('tableDelete', { roles: baseRole?.value, source: source.value }),
}
})
</script> </script>
<template> <template>
@@ -572,32 +590,18 @@ async function onRename() {
" "
/> />
<NcMenuItem
v-if="
isUIAllowed('tableDescriptionEdit', { roles: baseRole, source }) &&
!isUIAllowed('tableRename', { roles: baseRole, source })
"
:data-testid="`sidebar-table-description-${table.title}`"
class="nc-table-description"
@click="openTableDescriptionDialog(table)"
>
<div v-e="['c:table:update-description']" class="flex gap-2 items-center">
<!-- <GeneralIcon icon="ncAlignLeft" class="text-gray-700" /> -->
<GeneralIcon icon="ncAlignLeft" class="opacity-80" />
{{ $t('labels.editTableDescription') }}
</div>
</NcMenuItem>
<template <template
v-if=" v-if="
!isSharedBase && !isSharedBase &&
(isUIAllowed('tableRename', { roles: baseRole, source }) || (enabledOptions.tableRename ||
isUIAllowed('tableDelete', { roles: baseRole, source })) enabledOptions.tableDescriptionEdit ||
enabledOptions.tableDuplicate ||
enabledOptions.tablePermission)
" "
> >
<NcDivider /> <NcDivider v-if="enabledOptions.tableRename || enabledOptions.tableDuplicate" />
<NcMenuItem <NcMenuItem
v-if="isUIAllowed('tableRename', { roles: baseRole, source })" v-if="enabledOptions.tableRename"
:data-testid="`sidebar-table-rename-${table.title}`" :data-testid="`sidebar-table-rename-${table.title}`"
class="nc-table-rename" class="nc-table-rename"
@click="onRenameMenuClick(table)" @click="onRenameMenuClick(table)"
@@ -609,12 +613,7 @@ async function onRename() {
</NcMenuItem> </NcMenuItem>
<NcMenuItem <NcMenuItem
v-if=" v-if="enabledOptions.tableDuplicate"
isUIAllowed('tableDuplicate', {
source,
}) &&
(source?.is_meta || source?.is_local)
"
:data-testid="`sidebar-table-duplicate-${table.title}`" :data-testid="`sidebar-table-duplicate-${table.title}`"
@click="duplicateTable(table)" @click="duplicateTable(table)"
> >
@@ -626,26 +625,18 @@ async function onRename() {
<NcDivider /> <NcDivider />
<NcMenuItem <NcMenuItem
v-if="isUIAllowed('tableDescriptionEdit', { roles: baseRole, source })" v-if="enabledOptions.tableDescriptionEdit"
:data-testid="`sidebar-table-description-${table.title}`" :data-testid="`sidebar-table-description-${table.title}`"
class="nc-table-description" class="nc-table-description"
@click="openTableDescriptionDialog(table)" @click="openTableDescriptionDialog(table)"
> >
<div v-e="['c:table:update-description']" class="flex gap-2 items-center"> <div v-e="['c:table:update-description']" class="flex gap-2 items-center">
<!-- <GeneralIcon icon="ncAlignLeft" class="text-gray-700" /> -->
<GeneralIcon icon="ncAlignLeft" class="opacity-80" /> <GeneralIcon icon="ncAlignLeft" class="opacity-80" />
{{ $t('labels.editTableDescription') }} {{ $t('labels.editTableDescription') }}
</div> </div>
</NcMenuItem> </NcMenuItem>
<PaymentUpgradeBadgeProvider <PaymentUpgradeBadgeProvider
v-if=" v-if="enabledOptions.tablePermission"
isTableAndFieldPermissionsEnabled &&
isEeUI &&
isUIAllowed('tableDuplicate', {
source,
}) &&
(source?.is_meta || source?.is_local)
"
:feature="PlanFeatureTypes.FEATURE_TABLE_AND_FIELD_PERMISSIONS" :feature="PlanFeatureTypes.FEATURE_TABLE_AND_FIELD_PERMISSIONS"
> >
<template #default="{ click }"> <template #default="{ click }">
@@ -682,6 +673,8 @@ async function onRename() {
</NcMenuItem> </NcMenuItem>
</template> </template>
</PaymentUpgradeBadgeProvider> </PaymentUpgradeBadgeProvider>
</template>
<template v-if="enabledOptions.tableDelete">
<NcDivider /> <NcDivider />
<NcMenuItem @click="onDuplicate"> <NcMenuItem @click="onDuplicate">
@@ -696,7 +689,6 @@ async function onRename() {
<NcDivider /> <NcDivider />
<NcMenuItem <NcMenuItem
v-if="isUIAllowed('tableDelete', { roles: baseRole, source })"
:data-testid="`sidebar-table-delete-${table.title}`" :data-testid="`sidebar-table-delete-${table.title}`"
class="nc-table-delete" class="nc-table-delete"
danger danger

View File

@@ -64,6 +64,7 @@ const rolePermissions = {
tableDelete: true, tableDelete: true,
tableDescriptionEdit: true, tableDescriptionEdit: true,
tableDuplicate: true, tableDuplicate: true,
tablePermission: true,
tableSort: true, tableSort: true,
layoutRename: true, layoutRename: true,
layoutDelete: true, layoutDelete: true,