π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
fix(nc-gui): use basePermissions from meta api if it is shared form view
Ramesh Manea19f865d5983
diff --git a/packages/nc-gui/composables/useSharedFormViewStore.ts b/packages/nc-gui/composables/useSharedFormViewStore.tsindex 608a1d65e6..bef19f88e0 100644--- a/packages/nc-gui/composables/useSharedFormViewStore.ts+++ b/packages/nc-gui/composables/useSharedFormViewStore.ts@@ -10,7 +10,7 @@ import type {StringOrNullType,TableType,} from 'nocodb-sdk'-import { RelationTypes, UITypes, isLinksOrLTAR, isSystemColumn, isVirtualCol } from 'nocodb-sdk'+import { PermissionEntity, PermissionKey, RelationTypes, UITypes, isLinksOrLTAR, isSystemColumn, isVirtualCol } from 'nocodb-sdk'import { isString } from '@vue/shared'import { useTitle } from '@vueuse/core'import type { RuleObject } from 'ant-design-vue/es/form'@@ -64,6 +64,8 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((shareconst { basesUser } = storeToRefs(basesStore)+ const { isAllowed } = usePermissions()+const { t } = useI18n()const route = useRoute()@@ -78,6 +80,10 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((shareconst allViewFilters = ref<Record<string, FilterType[]>>({})+ const isAddingEmptyRowPermitted = computed(() =>+ meta.value?.id ? isAllowed(PermissionEntity.TABLE, meta.value.id, PermissionKey.TABLE_RECORD_ADD) : true,+ )+const isValidRedirectUrl = computed(() => typeof sharedFormView.value?.redirect_url === 'string' && !!sharedFormView.value?.redirect_url?.trim(),)@@ -870,6 +876,7 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((shareisValidRedirectUrl,loadAllviewFilters,checkFieldVisibility,+ isAddingEmptyRowPermitted,}}, 'shared-form-view-store')diff --git a/packages/nc-gui/composables/useSharedView.ts b/packages/nc-gui/composables/useSharedView.tsindex 6c5d155936..7dce301c60 100644--- a/packages/nc-gui/composables/useSharedView.ts+++ b/packages/nc-gui/composables/useSharedView.ts@@ -1,4 +1,5 @@import {+ type BaseType,type CalendarType,ExportTypes,type FilterType,@@ -38,7 +39,10 @@ export function useSharedView() {pageSize: appInfoDefaultLimit,}))- const sharedView = useState<ViewType | undefined>('sharedView', () => undefined)+ const sharedView = useState<(ViewType & { basePermissions: BaseType['permissions'] }) | undefined>(+ 'sharedView',+ () => undefined,+ )const sorts = ref<SortType[]>([])