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
feat: Disable clone access for content editors (#5768)
Oleg Isonen9433f1e93809
diff --git a/packages/authorization-token/src/db/authorization-token.test.ts b/packages/authorization-token/src/db/authorization-token.test.tsindex f4c532c94d..6987d50578 100644--- a/packages/authorization-token/src/db/authorization-token.test.ts+++ b/packages/authorization-token/src/db/authorization-token.test.ts@@ -40,13 +40,14 @@ describe("applyTokenPermissions", () => {expect(result.canCopy).toBe(false);});- test("editors: canClone and canCopy forced to true, canPublish unchanged", () => {+ test("editors: canClone forced to false, canCopy forced to true, canPublish unchanged", () => {const result = applyTokenPermissions({...baseToken,relation: "editors",+ canClone: true,canPublish: false,});- expect(result.canClone).toBe(true);+ expect(result.canClone).toBe(false);expect(result.canCopy).toBe(true);expect(result.canPublish).toBe(false);});diff --git a/packages/authorization-token/src/db/authorization-token.ts b/packages/authorization-token/src/db/authorization-token.tsindex e857a85bd7..50f00f5e2b 100644--- a/packages/authorization-token/src/db/authorization-token.ts+++ b/packages/authorization-token/src/db/authorization-token.ts@@ -14,7 +14,16 @@ const applyTokenPermissions = (let result = token;// @todo: fix this on SQL level- if (token.relation !== "viewers") {+ if (token.relation === "editors") {+ result = {+ ...result,+ canClone: false,+ canCopy: true,+ };+ }++ // @todo: fix this on SQL level+ if (token.relation === "builders" || token.relation === "administrators") {result = {...result,canClone: true,