mirror of
https://github.com/labring/FastGPT.git
synced 2025-10-22 20:04:01 +00:00
fix: app get readable team plugin error (#2169)
In the former code. User who access the plugin should have Write Permission which should be Read.
This commit is contained in:
@@ -10,21 +10,21 @@ import { FlowNodeTemplateType } from '@fastgpt/global/core/workflow/type/node.d'
|
|||||||
import { NextAPI } from '@/service/middleware/entry';
|
import { NextAPI } from '@/service/middleware/entry';
|
||||||
import { ApiRequestProps } from '@fastgpt/service/type/next';
|
import { ApiRequestProps } from '@fastgpt/service/type/next';
|
||||||
import { authApp } from '@fastgpt/service/support/permission/app/auth';
|
import { authApp } from '@fastgpt/service/support/permission/app/auth';
|
||||||
import { WritePermissionVal } from '@fastgpt/global/support/permission/constant';
|
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||||
import { PluginSourceEnum } from '@fastgpt/global/core/plugin/constants';
|
import { PluginSourceEnum } from '@fastgpt/global/core/plugin/constants';
|
||||||
|
|
||||||
export type GetPreviewNodeQuery = { appId: string };
|
export type GetPreviewNodeQuery = { appId: string };
|
||||||
|
|
||||||
async function handler(
|
async function handler(
|
||||||
req: ApiRequestProps<{}, GetPreviewNodeQuery>,
|
req: ApiRequestProps<{}, GetPreviewNodeQuery>,
|
||||||
res: NextApiResponse<any>
|
_res: NextApiResponse<any>
|
||||||
): Promise<FlowNodeTemplateType> {
|
): Promise<FlowNodeTemplateType> {
|
||||||
const { appId } = req.query;
|
const { appId } = req.query;
|
||||||
|
|
||||||
const { source } = await splitCombinePluginId(appId);
|
const { source } = await splitCombinePluginId(appId);
|
||||||
|
|
||||||
if (source === PluginSourceEnum.personal) {
|
if (source === PluginSourceEnum.personal) {
|
||||||
await authApp({ req, authToken: true, appId, per: WritePermissionVal });
|
await authApp({ req, authToken: true, appId, per: ReadPermissionVal });
|
||||||
}
|
}
|
||||||
|
|
||||||
return getPluginPreviewNode({ id: appId });
|
return getPluginPreviewNode({ id: appId });
|
||||||
|
Reference in New Issue
Block a user