mirror of
https://github.com/FlowiseAI/Flowise.git
synced 2026-10-12 02:02:17 +00:00
fix: flowise-318 (#6335)
* update: vars permissions check * fix: check in queue mode
This commit is contained in:
@@ -988,7 +988,7 @@ export const getVars = async (
|
||||
nodeData: INodeData,
|
||||
options: ICommonObject
|
||||
) => {
|
||||
if (!options.workspaceId) {
|
||||
if (!options.workspaceId || options.skipVariables) {
|
||||
return []
|
||||
}
|
||||
const variables =
|
||||
|
||||
@@ -94,7 +94,8 @@ const executeCustomFunction = async (req: Request, res: Response, next: NextFunc
|
||||
}
|
||||
const orgId = req.user?.activeOrganizationId
|
||||
const workspaceId = req.user?.activeWorkspaceId
|
||||
const apiResponse = await nodesService.executeCustomFunction(req.body, workspaceId, orgId)
|
||||
const canViewVariables = !!(req.user?.isOrganizationAdmin || req.user?.permissions?.includes('variables:view'))
|
||||
const apiResponse = await nodesService.executeCustomFunction(req.body, workspaceId, orgId, canViewVariables)
|
||||
return res.json(apiResponse)
|
||||
} catch (error) {
|
||||
next(error)
|
||||
|
||||
@@ -92,7 +92,8 @@ export class PredictionQueue extends BaseQueue {
|
||||
componentNodes: this.componentNodes,
|
||||
data: executeCustomFunctionData.data,
|
||||
workspaceId: executeCustomFunctionData.workspaceId,
|
||||
orgId: executeCustomFunctionData.orgId
|
||||
orgId: executeCustomFunctionData.orgId,
|
||||
canViewVariables: executeCustomFunctionData.canViewVariables
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -126,13 +126,14 @@ const getSingleNodeAsyncOptions = async (nodeName: string, requestBody: any): Pr
|
||||
}
|
||||
|
||||
// execute custom function node
|
||||
const executeCustomFunction = async (requestBody: any, workspaceId?: string, orgId?: string) => {
|
||||
const executeCustomFunction = async (requestBody: any, workspaceId?: string, orgId?: string, canViewVariables?: boolean) => {
|
||||
const appServer = getRunningExpressApp()
|
||||
const executeData = {
|
||||
appDataSource: appServer.AppDataSource,
|
||||
componentNodes: appServer.nodesPool.componentNodes,
|
||||
data: requestBody,
|
||||
isExecuteCustomFunction: true,
|
||||
canViewVariables,
|
||||
orgId,
|
||||
workspaceId
|
||||
}
|
||||
|
||||
@@ -11,13 +11,15 @@ export const executeCustomNodeFunction = async ({
|
||||
componentNodes,
|
||||
data,
|
||||
workspaceId,
|
||||
orgId
|
||||
orgId,
|
||||
canViewVariables
|
||||
}: {
|
||||
appDataSource: DataSource
|
||||
componentNodes: IComponentNodes
|
||||
data: any
|
||||
workspaceId?: string
|
||||
orgId?: string
|
||||
canViewVariables?: boolean
|
||||
}) => {
|
||||
try {
|
||||
const body = data
|
||||
@@ -43,7 +45,8 @@ export const executeCustomNodeFunction = async ({
|
||||
appDataSource,
|
||||
databaseEntities,
|
||||
workspaceId,
|
||||
orgId
|
||||
orgId,
|
||||
skipVariables: !canViewVariables
|
||||
}
|
||||
|
||||
const returnData = await newNodeInstance.init(nodeData, '', options)
|
||||
|
||||
Reference in New Issue
Block a user