mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 03:45:10 +00:00
fix: bug
This commit is contained in:
parent
681b551697
commit
137d912802
@ -52,10 +52,16 @@ export const actionDesignerCss = css`
|
||||
}
|
||||
`;
|
||||
|
||||
const actionAclCheck = function useAclCheck(actionPath) {
|
||||
export function useAclCheck(actionPath) {
|
||||
const aclCheck = useAclCheckFn();
|
||||
return aclCheck(actionPath);
|
||||
}
|
||||
|
||||
function useAclCheckFn() {
|
||||
const { data, inResources, getResourceActionParams, getStrategyActionParams } = useACLRolesCheck();
|
||||
const recordPkValue = useRecordPkValue();
|
||||
const collection = useCollection();
|
||||
function actionAclCheck(actionPath: string) {
|
||||
const resource = collection.resource;
|
||||
const parseAction = (actionPath: string, options: any = {}) => {
|
||||
const [resourceName] = actionPath.split(':');
|
||||
@ -81,7 +87,10 @@ const actionAclCheck = function useAclCheck(actionPath) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
return actionAclCheck;
|
||||
}
|
||||
|
||||
export const CreateRecordAction = observer(
|
||||
(props: any) => {
|
||||
@ -95,7 +104,6 @@ export const CreateRecordAction = observer(
|
||||
const ctx = useActionContext();
|
||||
const variables = useVariables();
|
||||
const localVariables = useLocalVariables({ currentForm: { values } as any });
|
||||
|
||||
useEffect(() => {
|
||||
field.stateOfLinkageRules = {};
|
||||
linkageRules
|
||||
@ -153,6 +161,7 @@ export const CreateAction = observer(
|
||||
const field: any = useField();
|
||||
const form = useForm();
|
||||
const variables = useVariables();
|
||||
const aclCheck = useAclCheckFn();
|
||||
|
||||
const enableChildren = fieldSchema['x-enable-children'] || [];
|
||||
const allowAddToCurrent = fieldSchema?.['x-allow-add-to-current'];
|
||||
@ -177,7 +186,7 @@ export const CreateAction = observer(
|
||||
};
|
||||
})
|
||||
.filter((v) => {
|
||||
return v && actionAclCheck(`${v.name}:create`);
|
||||
return v && aclCheck(`${v.name}:create`);
|
||||
});
|
||||
}, [enableChildren, totalChildCollections]);
|
||||
const linkageRules: any[] = fieldSchema?.['x-linkage-rules'] || [];
|
||||
|
Loading…
Reference in New Issue
Block a user