From b8bfc17a59789d70c721b9df720ca5c591b26f3a Mon Sep 17 00:00:00 2001 From: Katherine Date: Thu, 24 Apr 2025 17:09:11 +0800 Subject: [PATCH] refactor: adjust view collection action permission control (#6764) --- packages/core/client/src/acl/ACLProvider.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/core/client/src/acl/ACLProvider.tsx b/packages/core/client/src/acl/ACLProvider.tsx index 7c72f1e8a5..755ed2ee12 100644 --- a/packages/core/client/src/acl/ACLProvider.tsx +++ b/packages/core/client/src/acl/ACLProvider.tsx @@ -311,6 +311,8 @@ export const ACLActionProvider = (props) => { let actionPath = schema['x-acl-action']; // 只兼容这些数据表资源按钮 const resourceActionPath = ['create', 'update', 'destroy', 'importXlsx', 'export']; + // 视图表无编辑权限时不支持的操作 + const writableViewCollectionAction = ['create', 'update', 'destroy', 'importXlsx', 'bulkDestroy', 'bulkUpdate']; if (!actionPath && resource && schema['x-action'] && resourceActionPath.includes(schema['x-action'])) { actionPath = `${resource}:${schema['x-action']}`; @@ -334,15 +336,15 @@ export const ACLActionProvider = (props) => { if (!params) { return {props.children}; } - //视图表无编辑权限时仅支持显示导出按钮 + //视图表无编辑权限时不支持 writableViewCollectionAction 的按钮 if ( - ['create', 'update', 'destroy', 'importXlsx'].includes(actionPath) || - ['create', 'update', 'destroy', 'importXlsx'].includes(actionPath?.split(':')[1]) + writableViewCollectionAction.includes(actionPath) || + writableViewCollectionAction.includes(actionPath?.split(':')[1]) ) { if ((collection && collection.template !== 'view') || collection?.writableView) { return {props.children}; } - return null; + return {props.children}; } return {props.children}; };