refactor: acl collection field provider (#2679)
This commit is contained in:
parent
91095d8fe0
commit
ebc1d1afb4
@ -261,8 +261,7 @@ export const ACLCollectionFieldProvider = (props) => {
|
||||
const { allowAll } = useACLRoleContext();
|
||||
const { whitelist } = useACLFieldWhitelist();
|
||||
const [name] = (fieldSchema.name as string).split('.');
|
||||
const allowed = whitelist.length > 0 ? whitelist.includes(name) : true;
|
||||
|
||||
const allowed = !fieldSchema['x-acl-ignore'] && whitelist.length > 0 ? whitelist.includes(name) : true;
|
||||
useEffect(() => {
|
||||
if (!allowed) {
|
||||
field.required = false;
|
||||
|
@ -5,7 +5,7 @@ import uniq from 'lodash/uniq';
|
||||
import React, { useContext } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useAPIClient, useRequest } from '../../api-client';
|
||||
import { SchemaComponent, FormItem } from '../../schema-component';
|
||||
import { SchemaComponent } from '../../schema-component';
|
||||
import { PermissionContext } from './PermisionProvider';
|
||||
|
||||
const SnippetCheckboxGroup = connect((props) => {
|
||||
@ -57,7 +57,7 @@ export const RoleConfigure = () => {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<SchemaComponent
|
||||
components={{ SnippetCheckboxGroup, FormItem }}
|
||||
components={{ SnippetCheckboxGroup }}
|
||||
schema={{
|
||||
type: 'void',
|
||||
name: 'form',
|
||||
|
@ -44,8 +44,6 @@ export const ImportActionInitializer = (props) => {
|
||||
const { exists, remove } = useCurrentSchema('importXlsx', 'x-action', item.find, item.remove);
|
||||
const { name } = useCollection();
|
||||
const fields = useFields(name);
|
||||
const { token } = useToken();
|
||||
|
||||
const schema: ISchema = {
|
||||
type: 'void',
|
||||
title: '{{ t("Import") }}',
|
||||
@ -77,16 +75,12 @@ export const ImportActionInitializer = (props) => {
|
||||
formLayout: {
|
||||
type: 'void',
|
||||
'x-component': 'FormLayout',
|
||||
'x-component-props': {
|
||||
labelCol: 6,
|
||||
wrapperCol: 10,
|
||||
layout: 'vertical',
|
||||
},
|
||||
properties: {
|
||||
download: {
|
||||
type: 'void',
|
||||
title: `{{ t("Step 1: Download template", {ns: "${NAMESPACE}" }) }}`,
|
||||
'x-component': 'FormItem',
|
||||
'x-acl-ignore': true,
|
||||
properties: {
|
||||
tip: {
|
||||
type: 'void',
|
||||
@ -120,6 +114,7 @@ export const ImportActionInitializer = (props) => {
|
||||
type: 'array',
|
||||
title: `{{ t("Step 2: Upload Excel", {ns: "${NAMESPACE}" }) }}`,
|
||||
'x-decorator': 'FormItem',
|
||||
'x-acl-ignore': true,
|
||||
'x-component': 'Upload.Dragger',
|
||||
'x-validator': '{{ uploadValidator }}',
|
||||
'x-component-props': {
|
||||
|
Loading…
Reference in New Issue
Block a user