From b652e2163cc274ca037464cdaf660ff3ad32b416 Mon Sep 17 00:00:00 2001 From: Ivan Starkov Date: Thu, 16 Feb 2023 16:17:23 +0400 Subject: [PATCH] Fix clone (#1037) ## Description 1. What is this PR about (link the issue and add a short description) ## Steps for reproduction Now works http://localhost:3000/rest/project/clone/webstudiois ## Code Review - [ ] hi @kof, I need you to do - conceptual review (architecture, feature-correctness) - detailed review (read every line) - test it on preview ## Before requesting a review - [ ] made a self-review - [ ] added inline comments where things may be not obvious (the "why", not "what") ## Before merging - [ ] tested locally and on preview environment (preview dev login: 5de6) - [ ] updated [test cases](https://github.com/webstudio-is/webstudio-builder/blob/main/apps/builder/docs/test-cases.md) document - [ ] added tests - [ ] if any new env variables are added, added them to `.env.example` and the `builder/env-check.js` if mandatory --- .../trpc-interface/src/authorize/project.server.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/trpc-interface/src/authorize/project.server.ts b/packages/trpc-interface/src/authorize/project.server.ts index 5601a75c43..27af180152 100644 --- a/packages/trpc-interface/src/authorize/project.server.ts +++ b/packages/trpc-interface/src/authorize/project.server.ts @@ -48,6 +48,17 @@ export const hasProjectPermit = async ( return true; } + // Allow load webstudiois for clone + // @todo Rethink permissions for this use-case + // The plan is to make new permission for projects which are allowed to be publicly clonable by anyone + // https://github.com/webstudio-is/webstudio-builder/issues/1038 + if ( + props.permit === "view" && + props.projectId === "62154aaef0cb0860ccf85d6e" + ) { + return true; + } + // Edge-case to allow access the project on the canvas if ( props.permit === "view" &&