fix(api): ensure when api user dont have org_id, check for workflow that org_id must be null as well

This commit is contained in:
BennyKok 2024-01-01 23:55:33 +08:00
parent 40d9060fda
commit 56ea34f2fa
2 changed files with 5 additions and 2 deletions

View File

@ -68,7 +68,10 @@ export const createRun = withServerPromise(
}
} else {
// is user api call, check user only
if (apiUser.user_id != workflow_version_data.workflow.user_id) {
if (
apiUser.user_id != workflow_version_data.workflow.user_id &&
workflow_version_data.workflow.org_id == null
) {
throw new Error("Workflow not found");
}
}

View File

@ -69,7 +69,7 @@ export async function getRunsData(user: APIKeyUserType, run_id: string) {
}
} else {
// is user api call, check user only
if (data.workflow.user_id != user.user_id) {
if (data.workflow.user_id != user.user_id && data.workflow.org_id == null) {
return null;
}
}