mirror of
https://gitee.com/nocobase/nocobase.git
synced 2024-12-02 20:27:49 +08:00
fix(acl): add x-acl-action to action schema
This commit is contained in:
parent
6b253755a1
commit
e5a9721674
@ -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: {},
|
||||
|
@ -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: {
|
||||
|
@ -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: {},
|
||||
|
@ -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,
|
||||
},
|
||||
|
@ -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 <ActionInitializer {...props} schema={schema} />;
|
||||
useProps: '{{ useBulkDestroyActionProps }}',
|
||||
},
|
||||
};
|
||||
if (collection) {
|
||||
schema['x-acl-action'] = `${collection.name}:destroy`;
|
||||
}
|
||||
return <ActionInitializer {...props} schema={schema} />;
|
||||
};
|
||||
|
@ -1,7 +1,14 @@
|
||||
import React from 'react';
|
||||
|
||||
import { BlockInitializer } from '.';
|
||||
import { useCollection } from '../../collection-manager';
|
||||
|
||||
export const CustomizeActionInitializer = (props) => {
|
||||
return <BlockInitializer {...props} />;
|
||||
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 <BlockInitializer {...props} schema={schema} />;
|
||||
};
|
||||
|
@ -13,6 +13,7 @@ export const CustomizeBulkEditActionInitializer = (props) => {
|
||||
},
|
||||
'x-component-props': {
|
||||
openMode: 'drawer',
|
||||
icon: 'EditOutlined',
|
||||
},
|
||||
properties: {
|
||||
drawer: {
|
||||
|
Loading…
Reference in New Issue
Block a user