Open source website builder and Webflow alternative. Webstudio is an advanced visual builder that connects to any headless CMS, supports all CSS properties, and can be hosted anywhere, including with us.
TypeScript accessibilityalternativecloudflarecloudflare-workersdesignfreefrontendopen-sourceradix-uireactremixweb-developmentwebflowwebsite-builderwebsite-developmentwebsiteswebstudio
fix: Return the check for templates permission (#2878)
Oleg Isonen22be073e6c75
diff --git a/fixtures/webstudio-custom-template/.webstudio/data.json b/fixtures/webstudio-custom-template/.webstudio/data.jsonindex 91b27c913b..f9296feb82 100644--- a/fixtures/webstudio-custom-template/.webstudio/data.json+++ b/fixtures/webstudio-custom-template/.webstudio/data.json@@ -1,10 +1,10 @@{"build": {- "id": "004b90b4-7038-4c4e-bd6c-d29f6f68fe94",+ "id": "5eb1ac93-67ea-45e9-86a7-152a34d5dab6","projectId": "0d856812-61d8-4014-a20a-82e01c0eb8ee","version": 113,- "createdAt": "2024-02-01T08:22:38.726Z",- "updatedAt": "2024-02-01T08:22:38.726Z",+ "createdAt": "2024-02-07T18:05:33.222Z",+ "updatedAt": "2024-02-07T18:05:33.222Z","pages": {"meta": {"siteName": "Fixture Site",diff --git a/fixtures/webstudio-custom-template/app/__generated__/[sitemap.xml].ts b/fixtures/webstudio-custom-template/app/__generated__/[sitemap.xml].tsindex f7dcdd540a..5f65ed8058 100644--- a/fixtures/webstudio-custom-template/app/__generated__/[sitemap.xml].ts+++ b/fixtures/webstudio-custom-template/app/__generated__/[sitemap.xml].ts@@ -2,11 +2,11 @@ export const sitemap = {pages: [{path: "",- lastModified: "2024-02-01T08:22:38.726Z",+ lastModified: "2024-02-07T18:05:33.222Z",},{path: "/script-test",- lastModified: "2024-02-01T08:22:38.726Z",+ lastModified: "2024-02-07T18:05:33.222Z",},],};diff --git a/packages/trpc-interface/src/authorize/project.server.ts b/packages/trpc-interface/src/authorize/project.server.tsindex 9ce3358217..fe23a30356 100644--- a/packages/trpc-interface/src/authorize/project.server.ts+++ b/packages/trpc-interface/src/authorize/project.server.ts@@ -51,6 +51,13 @@ export const hasProjectPermit = async (return true;}+ const isTemplate = context.authorization.projectTemplates.includes(+ props.projectId+ );+ if (props.permit === "view" && isTemplate) {+ return true;+ }+// Check if the user is allowed to access the projectif (authorization.userId !== undefined) {checks.push(