Skip to content

πŸ”₯ πŸ”₯ πŸ”₯ A Free & Self-hostable Airtable Alternative

fix(nc-gui): some form permissions issue

Ramesh Mane783836000a35
diff --git a/packages/nc-gui/components/smartsheet/Form.vue b/packages/nc-gui/components/smartsheet/Form.vue
index 15bc407d46..471babae4d 100644
--- a/packages/nc-gui/components/smartsheet/Form.vue
+++ b/packages/nc-gui/components/smartsheet/Form.vue
@@ -188,7 +188,11 @@ const { open, onChange: onChangeFile } = useFileDialog({
})
const isAllowedToAddRecord = computed(
- () => !meta?.value?.id || isAllowed(PermissionEntity.TABLE, meta.value.id, PermissionKey.TABLE_RECORD_ADD),
+ () =>
+ !meta?.value?.id ||
+ isAllowed(PermissionEntity.TABLE, meta.value.id, PermissionKey.TABLE_RECORD_ADD, {
+ isFormView: true,
+ }),
)
const disableFormSubmit = computed(
@@ -324,7 +328,6 @@ const updatePreFillFormSearchParams = useDebounceFn(() => {
const isFormSubmitting = ref(false)
-
async function submitForm() {
if (disableFormSubmit.value) return
diff --git a/packages/nc-gui/composables/useSharedFormViewStore.ts b/packages/nc-gui/composables/useSharedFormViewStore.ts
index b7325cdf81..a2f6c1c20a 100644
--- a/packages/nc-gui/composables/useSharedFormViewStore.ts
+++ b/packages/nc-gui/composables/useSharedFormViewStore.ts
@@ -81,7 +81,9 @@ const [useProvideSharedFormStore, useSharedFormStore] = useInjectionState((share
const allViewFilters = ref<Record<string, FilterType[]>>({})
const isAddingEmptyRowPermitted = computed(() =>
- meta.value?.id ? isAllowed(PermissionEntity.TABLE, meta.value.id, PermissionKey.TABLE_RECORD_ADD) : true,
+ meta.value?.id
+ ? isAllowed(PermissionEntity.TABLE, meta.value.id, PermissionKey.TABLE_RECORD_ADD, { isFormView: true })
+ : true,
)
const isValidRedirectUrl = computed(
diff --git a/packages/nc-gui/lang/en.json b/packages/nc-gui/lang/en.json
index 55193cf5ee..49ff179f57 100644
--- a/packages/nc-gui/lang/en.json
+++ b/packages/nc-gui/lang/en.json
@@ -616,8 +616,7 @@
"generalPermissionTooltip": "You do not have permission to perform this action",
"uploadDataTooltip": "You do not have permission to upload data into this table",
"formCannotAcceptSubmissions": "Form cannot accept submissions.",
- "formCannotAcceptSubmissionsDescription": "You don't have permission to submit responses to this form.",
- "sharedFormCannotAcceptSubmissionsDescription": "Adding new record in table is restricted, which prevents submitting responses via this form."
+ "formCannotAcceptSubmissionsDescription": "Adding new record in table is restricted, which prevents submitting responses via this form."
}
},
"datatype": {