diff --git a/packages/core/client/src/schema-initializer/buttons/CalendarFormActionInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/CalendarFormActionInitializers.tsx index edf9fa6743..6677f3d2e4 100644 --- a/packages/core/client/src/schema-initializer/buttons/CalendarFormActionInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/CalendarFormActionInitializers.tsx @@ -116,6 +116,7 @@ export const CalendarFormActionInitializers = { title: '{{ t("Update record") }}', 'x-component': 'Action', 'x-designer': 'Action.Designer', + 'x-acl-action': 'update', 'x-action': 'customize:update', 'x-action-settings': { assignedValues: {}, diff --git a/packages/core/client/src/schema-initializer/buttons/ReadPrettyFormActionInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/ReadPrettyFormActionInitializers.tsx index 5217f8f1ee..eb0cda14a1 100644 --- a/packages/core/client/src/schema-initializer/buttons/ReadPrettyFormActionInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/ReadPrettyFormActionInitializers.tsx @@ -108,6 +108,7 @@ export const ReadPrettyFormActionInitializers = { 'x-component': 'Action', 'x-designer': 'Action.Designer', 'x-action': 'customize:update', + 'x-acl-action': 'update', 'x-action-settings': { assignedValues: {}, onSuccess: { diff --git a/packages/core/client/src/schema-initializer/buttons/TableActionColumnInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/TableActionColumnInitializers.tsx index eb2f9971da..63657087dc 100644 --- a/packages/core/client/src/schema-initializer/buttons/TableActionColumnInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/TableActionColumnInitializers.tsx @@ -135,6 +135,7 @@ export const TableActionColumnInitializers = (props: any) => { title: '{{ t("Update record") }}', 'x-component': 'Action.Link', 'x-action': 'customize:update', + 'x-acl-action': 'update', 'x-designer': 'Action.Designer', 'x-action-settings': { assignedValues: {}, diff --git a/packages/core/client/src/schema-initializer/buttons/TableActionInitializers.tsx b/packages/core/client/src/schema-initializer/buttons/TableActionInitializers.tsx index 512c876a0d..95689d6e50 100644 --- a/packages/core/client/src/schema-initializer/buttons/TableActionInitializers.tsx +++ b/packages/core/client/src/schema-initializer/buttons/TableActionInitializers.tsx @@ -37,9 +37,6 @@ export const TableActionInitializers = { schema: { 'x-align': 'right', 'x-decorator': 'ACLActionProvider', - 'x-acl-action-props': { - skipScopeCheck: true, - }, }, }, { @@ -48,9 +45,6 @@ export const TableActionInitializers = { component: 'RefreshActionInitializer', schema: { 'x-align': 'right', - 'x-acl-action-props': { - skipScopeCheck: true, - }, }, }, ], @@ -71,6 +65,7 @@ export const TableActionInitializers = { title: '{{ t("Bulk update") }}', 'x-component': 'Action', 'x-align': 'right', + 'x-acl-action': 'update', 'x-decorator': 'ACLActionProvider', 'x-acl-action-props': { skipScopeCheck: true, @@ -87,6 +82,7 @@ export const TableActionInitializers = { }, }, 'x-component-props': { + icon: 'EditOutlined', useProps: '{{ useCustomizeBulkUpdateActionProps }}', }, }, @@ -98,6 +94,7 @@ export const TableActionInitializers = { schema: { 'x-align': 'right', 'x-decorator': 'ACLActionProvider', + 'x-acl-action': 'update', 'x-acl-action-props': { skipScopeCheck: true, }, diff --git a/packages/core/client/src/schema-initializer/items/BulkDestroyActionInitializer.tsx b/packages/core/client/src/schema-initializer/items/BulkDestroyActionInitializer.tsx index 3a8de2872d..f3faab1578 100644 --- a/packages/core/client/src/schema-initializer/items/BulkDestroyActionInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/BulkDestroyActionInitializer.tsx @@ -1,21 +1,30 @@ -import React from "react"; +import React from 'react'; +import { useCollection } from '../../collection-manager'; -import { ActionInitializer } from "./ActionInitializer"; +import { ActionInitializer } from './ActionInitializer'; export const BulkDestroyActionInitializer = (props) => { - const schema = { - title: '{{ t("Delete") }}', - 'x-action': 'destroy', - 'x-component': 'Action', - 'x-designer': 'Action.Designer', - 'x-component-props': { - icon: 'DeleteOutlined', - confirm: { - title: "{{t('Delete record')}}", - content: "{{t('Are you sure you want to delete it?')}}", - }, - useProps: '{{ useBulkDestroyActionProps }}', + const collection = useCollection(); + const schema = { + title: '{{ t("Delete") }}', + 'x-action': 'destroy', + 'x-component': 'Action', + 'x-designer': 'Action.Designer', + 'x-decorator': 'ACLActionProvider', + 'x-acl-action-props': { + skipScopeCheck: true, + }, + 'x-component-props': { + icon: 'DeleteOutlined', + confirm: { + title: "{{t('Delete record')}}", + content: "{{t('Are you sure you want to delete it?')}}", }, - }; - return ; + useProps: '{{ useBulkDestroyActionProps }}', + }, }; + if (collection) { + schema['x-acl-action'] = `${collection.name}:destroy`; + } + return ; +}; diff --git a/packages/core/client/src/schema-initializer/items/CustomizeActionInitializer.tsx b/packages/core/client/src/schema-initializer/items/CustomizeActionInitializer.tsx index 2e4152647b..7c8620c32c 100644 --- a/packages/core/client/src/schema-initializer/items/CustomizeActionInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/CustomizeActionInitializer.tsx @@ -1,7 +1,14 @@ import React from 'react'; import { BlockInitializer } from '.'; +import { useCollection } from '../../collection-manager'; export const CustomizeActionInitializer = (props) => { - return ; + const collection = useCollection(); + const schema = {}; + if (collection && schema['x-acl-action']) { + schema['x-acl-action'] = `${collection.name}:${schema['x-acl-action']}`; + schema['x-decorator'] = 'ACLActionProvider'; + } + return ; }; diff --git a/packages/core/client/src/schema-initializer/items/CustomizeBulkEditActionInitializer.tsx b/packages/core/client/src/schema-initializer/items/CustomizeBulkEditActionInitializer.tsx index 918a05b5e2..b35e5add12 100644 --- a/packages/core/client/src/schema-initializer/items/CustomizeBulkEditActionInitializer.tsx +++ b/packages/core/client/src/schema-initializer/items/CustomizeBulkEditActionInitializer.tsx @@ -13,6 +13,7 @@ export const CustomizeBulkEditActionInitializer = (props) => { }, 'x-component-props': { openMode: 'drawer', + icon: 'EditOutlined', }, properties: { drawer: {