only allow to add steps of user's workflow (#4637)

Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
Carina WollendorferandCarinaWolli authored and GitHub committed 2022-09-20 17:00:43 +00:00
1 parent 0a2de203a6
commit 4e6e484d8b
2 files changed
+5 -3

No files matched your search

@@ -616,9 +616,11 @@ export const workflowsRouter = createProtectedRouter()
//added steps
const addedSteps = steps.map((s) => {
if (s.id <= 0) {
const { id, ...stepToAdd } = s;
if (stepToAdd) {
const { id: stepId, ...stepToAdd } = s;
if (stepToAdd.workflowId === id) {
return stepToAdd;
} else {
throw new TRPCError({ code: "UNAUTHORIZED" });
}
}
});