WIP - more fix for permissions
This commit is contained in:
@@ -124,6 +124,15 @@ const editConfig = computed(() => {
|
|||||||
return config
|
return config
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Compute canCreate based on objectAccess
|
||||||
|
// Note: MySQL BOOLEAN fields return 0/1 (numbers), not true/false
|
||||||
|
const canCreate = computed(() => {
|
||||||
|
const publicCreate = objectAccess.value?.publicCreate
|
||||||
|
const result = publicCreate === true || publicCreate === 1
|
||||||
|
console.log('[PAGE] canCreate computed:', result, '(publicCreate:', publicCreate, 'type:', typeof publicCreate, ')')
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
|
||||||
// Debug current view state
|
// Debug current view state
|
||||||
watch([view, recordId, editConfig, currentRecord, loading, dataLoading], ([v, rid, ec, cr, l, dl]) => {
|
watch([view, recordId, editConfig, currentRecord, loading, dataLoading], ([v, rid, ec, cr, l, dl]) => {
|
||||||
console.log('[PAGE] View state changed:')
|
console.log('[PAGE] View state changed:')
|
||||||
@@ -149,13 +158,12 @@ const fetchObjectDefinition = async () => {
|
|||||||
const accessResponse = await api.get(`/setup/objects/${objectApiName.value}/access`)
|
const accessResponse = await api.get(`/setup/objects/${objectApiName.value}/access`)
|
||||||
objectAccess.value = accessResponse
|
objectAccess.value = accessResponse
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('Failed to fetch access permissions:', e)
|
// Set defaults if fetch fails - assume most restrictive
|
||||||
// Set defaults if fetch fails
|
|
||||||
objectAccess.value = {
|
objectAccess.value = {
|
||||||
publicCreate: true,
|
publicCreate: false,
|
||||||
publicRead: true,
|
publicRead: false,
|
||||||
publicUpdate: true,
|
publicUpdate: false,
|
||||||
publicDelete: true,
|
publicDelete: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
@@ -291,7 +299,7 @@ onMounted(async () => {
|
|||||||
:data="records"
|
:data="records"
|
||||||
:loading="dataLoading"
|
:loading="dataLoading"
|
||||||
:base-url="`/runtime/objects`"
|
:base-url="`/runtime/objects`"
|
||||||
:can-create="objectAccess?.publicCreate !== false"
|
:can-create="canCreate"
|
||||||
selectable
|
selectable
|
||||||
@row-click="handleRowClick"
|
@row-click="handleRowClick"
|
||||||
@create="handleCreate"
|
@create="handleCreate"
|
||||||
|
|||||||
Reference in New Issue
Block a user