mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 12:16:12 +00: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") }}',
|
title: '{{ t("Update record") }}',
|
||||||
'x-component': 'Action',
|
'x-component': 'Action',
|
||||||
'x-designer': 'Action.Designer',
|
'x-designer': 'Action.Designer',
|
||||||
|
'x-acl-action': 'update',
|
||||||
'x-action': 'customize:update',
|
'x-action': 'customize:update',
|
||||||
'x-action-settings': {
|
'x-action-settings': {
|
||||||
assignedValues: {},
|
assignedValues: {},
|
||||||
|
@ -108,6 +108,7 @@ export const ReadPrettyFormActionInitializers = {
|
|||||||
'x-component': 'Action',
|
'x-component': 'Action',
|
||||||
'x-designer': 'Action.Designer',
|
'x-designer': 'Action.Designer',
|
||||||
'x-action': 'customize:update',
|
'x-action': 'customize:update',
|
||||||
|
'x-acl-action': 'update',
|
||||||
'x-action-settings': {
|
'x-action-settings': {
|
||||||
assignedValues: {},
|
assignedValues: {},
|
||||||
onSuccess: {
|
onSuccess: {
|
||||||
|
@ -135,6 +135,7 @@ export const TableActionColumnInitializers = (props: any) => {
|
|||||||
title: '{{ t("Update record") }}',
|
title: '{{ t("Update record") }}',
|
||||||
'x-component': 'Action.Link',
|
'x-component': 'Action.Link',
|
||||||
'x-action': 'customize:update',
|
'x-action': 'customize:update',
|
||||||
|
'x-acl-action': 'update',
|
||||||
'x-designer': 'Action.Designer',
|
'x-designer': 'Action.Designer',
|
||||||
'x-action-settings': {
|
'x-action-settings': {
|
||||||
assignedValues: {},
|
assignedValues: {},
|
||||||
|
@ -37,9 +37,6 @@ export const TableActionInitializers = {
|
|||||||
schema: {
|
schema: {
|
||||||
'x-align': 'right',
|
'x-align': 'right',
|
||||||
'x-decorator': 'ACLActionProvider',
|
'x-decorator': 'ACLActionProvider',
|
||||||
'x-acl-action-props': {
|
|
||||||
skipScopeCheck: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -48,9 +45,6 @@ export const TableActionInitializers = {
|
|||||||
component: 'RefreshActionInitializer',
|
component: 'RefreshActionInitializer',
|
||||||
schema: {
|
schema: {
|
||||||
'x-align': 'right',
|
'x-align': 'right',
|
||||||
'x-acl-action-props': {
|
|
||||||
skipScopeCheck: true,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -71,6 +65,7 @@ export const TableActionInitializers = {
|
|||||||
title: '{{ t("Bulk update") }}',
|
title: '{{ t("Bulk update") }}',
|
||||||
'x-component': 'Action',
|
'x-component': 'Action',
|
||||||
'x-align': 'right',
|
'x-align': 'right',
|
||||||
|
'x-acl-action': 'update',
|
||||||
'x-decorator': 'ACLActionProvider',
|
'x-decorator': 'ACLActionProvider',
|
||||||
'x-acl-action-props': {
|
'x-acl-action-props': {
|
||||||
skipScopeCheck: true,
|
skipScopeCheck: true,
|
||||||
@ -87,6 +82,7 @@ export const TableActionInitializers = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
'x-component-props': {
|
'x-component-props': {
|
||||||
|
icon: 'EditOutlined',
|
||||||
useProps: '{{ useCustomizeBulkUpdateActionProps }}',
|
useProps: '{{ useCustomizeBulkUpdateActionProps }}',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -98,6 +94,7 @@ export const TableActionInitializers = {
|
|||||||
schema: {
|
schema: {
|
||||||
'x-align': 'right',
|
'x-align': 'right',
|
||||||
'x-decorator': 'ACLActionProvider',
|
'x-decorator': 'ACLActionProvider',
|
||||||
|
'x-acl-action': 'update',
|
||||||
'x-acl-action-props': {
|
'x-acl-action-props': {
|
||||||
skipScopeCheck: true,
|
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) => {
|
export const BulkDestroyActionInitializer = (props) => {
|
||||||
const schema = {
|
const collection = useCollection();
|
||||||
title: '{{ t("Delete") }}',
|
const schema = {
|
||||||
'x-action': 'destroy',
|
title: '{{ t("Delete") }}',
|
||||||
'x-component': 'Action',
|
'x-action': 'destroy',
|
||||||
'x-designer': 'Action.Designer',
|
'x-component': 'Action',
|
||||||
'x-component-props': {
|
'x-designer': 'Action.Designer',
|
||||||
icon: 'DeleteOutlined',
|
'x-decorator': 'ACLActionProvider',
|
||||||
confirm: {
|
'x-acl-action-props': {
|
||||||
title: "{{t('Delete record')}}",
|
skipScopeCheck: true,
|
||||||
content: "{{t('Are you sure you want to delete it?')}}",
|
},
|
||||||
},
|
'x-component-props': {
|
||||||
useProps: '{{ useBulkDestroyActionProps }}',
|
icon: 'DeleteOutlined',
|
||||||
|
confirm: {
|
||||||
|
title: "{{t('Delete record')}}",
|
||||||
|
content: "{{t('Are you sure you want to delete it?')}}",
|
||||||
},
|
},
|
||||||
};
|
useProps: '{{ useBulkDestroyActionProps }}',
|
||||||
return <ActionInitializer {...props} schema={schema} />;
|
},
|
||||||
};
|
};
|
||||||
|
if (collection) {
|
||||||
|
schema['x-acl-action'] = `${collection.name}:destroy`;
|
||||||
|
}
|
||||||
|
return <ActionInitializer {...props} schema={schema} />;
|
||||||
|
};
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { BlockInitializer } from '.';
|
import { BlockInitializer } from '.';
|
||||||
|
import { useCollection } from '../../collection-manager';
|
||||||
|
|
||||||
export const CustomizeActionInitializer = (props) => {
|
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': {
|
'x-component-props': {
|
||||||
openMode: 'drawer',
|
openMode: 'drawer',
|
||||||
|
icon: 'EditOutlined',
|
||||||
},
|
},
|
||||||
properties: {
|
properties: {
|
||||||
drawer: {
|
drawer: {
|
||||||
|
Loading…
Reference in New Issue
Block a user