mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 04:25:10 +00:00
Merge branch 'T-2327-and-2771' of https://github.com/nocobase/nocobase into T-2327-and-2771
This commit is contained in:
commit
31ed99810c
@ -2,6 +2,7 @@ import { Field } from '@formily/core';
|
|||||||
import { Schema, useField, useFieldSchema } from '@formily/react';
|
import { Schema, useField, useFieldSchema } from '@formily/react';
|
||||||
import React, { createContext, useContext, useEffect } from 'react';
|
import React, { createContext, useContext, useEffect } from 'react';
|
||||||
import { Navigate } from 'react-router-dom';
|
import { Navigate } from 'react-router-dom';
|
||||||
|
import { omit } from 'lodash';
|
||||||
import { useAPIClient, useRequest } from '../api-client';
|
import { useAPIClient, useRequest } from '../api-client';
|
||||||
import { useAppSpin } from '../application/hooks/useAppSpin';
|
import { useAppSpin } from '../application/hooks/useAppSpin';
|
||||||
import { useBlockRequestContext } from '../block-provider/BlockProvider';
|
import { useBlockRequestContext } from '../block-provider/BlockProvider';
|
||||||
@ -10,6 +11,7 @@ import { useResourceActionContext } from '../collection-manager/ResourceActionPr
|
|||||||
import { useRecord } from '../record-provider';
|
import { useRecord } from '../record-provider';
|
||||||
import { SchemaComponentOptions, useDesignable } from '../schema-component';
|
import { SchemaComponentOptions, useDesignable } from '../schema-component';
|
||||||
import { useApp } from '../application';
|
import { useApp } from '../application';
|
||||||
|
import { useCollectionNamespace } from '../block-provider';
|
||||||
|
|
||||||
export const ACLContext = createContext<any>({});
|
export const ACLContext = createContext<any>({});
|
||||||
|
|
||||||
@ -91,7 +93,9 @@ export const ACLActionParamsContext = createContext<any>({});
|
|||||||
|
|
||||||
export const useACLRolesCheck = () => {
|
export const useACLRolesCheck = () => {
|
||||||
const ctx = useContext(ACLContext);
|
const ctx = useContext(ACLContext);
|
||||||
const data = ctx?.data?.data;
|
const ns = useCollectionNamespace();
|
||||||
|
const { dataSources: dataSourcesAcl } = ctx.data.meta;
|
||||||
|
const data = { ...ctx?.data?.data, ...omit(dataSourcesAcl?.[ns], 'snippets') };
|
||||||
const getActionAlias = (actionPath: string) => {
|
const getActionAlias = (actionPath: string) => {
|
||||||
const actionName = actionPath.split(':').pop();
|
const actionName = actionPath.split(':').pop();
|
||||||
return data?.actionAlias?.[actionName] || actionName;
|
return data?.actionAlias?.[actionName] || actionName;
|
||||||
|
Loading…
Reference in New Issue
Block a user