diff --git a/packages/plugins/@nocobase/plugin-acl/src/client/permissions/PluginPermissions.tsx b/packages/plugins/@nocobase/plugin-acl/src/client/permissions/PluginPermissions.tsx index eb32f9ab7e..301d61bdb6 100644 --- a/packages/plugins/@nocobase/plugin-acl/src/client/permissions/PluginPermissions.tsx +++ b/packages/plugins/@nocobase/plugin-acl/src/client/permissions/PluginPermissions.tsx @@ -2,6 +2,7 @@ import { useAPIClient, useApp, useCompile, useCollectionRecord, useRequest } fro import { Checkbox, message, Table } from 'antd'; import React, { useContext, useMemo, useState } from 'react'; import { useTranslation } from 'react-i18next'; +import { flatMap } from 'lodash'; import { useStyles } from './style'; import { RolesManagerContext } from '../RolesManagerProvider'; import lodash from 'lodash'; @@ -38,6 +39,15 @@ export const PluginPermissions: React.FC<{ const settings = app.pluginSettingsManager.getList(false); const allAclSnippets = app.pluginSettingsManager.getAclSnippets(); const [snippets, setSnippets] = useState([]); + const flatPlugins = useMemo(() => { + return flatMap(settings, (item) => { + if (item.children) { + return [item, ...item.children]; + } else { + return item; + } + }); + }, [settings]); const allChecked = useMemo( () => snippets.includes('pm.*') && snippets.every((item) => !item.startsWith('!pm.')), [snippets], @@ -57,7 +67,11 @@ export const PluginPermissions: React.FC<{ ready: !!role && active, refreshDeps: [role?.name], onSuccess(data) { - setSnippets(data?.data || []); + setSnippets( + data?.data.filter((v) => { + return flatPlugins.find((k) => v.includes(`!${k.aclSnippet}`) || !v.startsWith('!pm.')); + }) || [], + ); }, }, );