From 486ca9733057f00cecd391c3b29a0662a73871cc Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 7 Apr 2021 11:27:15 +0100 Subject: [PATCH] Fixing component definition test cases and fixing an issue found by authorized test case. --- packages/server/src/api/routes/tests/component.spec.js | 4 ++-- packages/server/src/middleware/authorized.js | 4 ---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/server/src/api/routes/tests/component.spec.js b/packages/server/src/api/routes/tests/component.spec.js index 35394a1537..14ec58cf38 100644 --- a/packages/server/src/api/routes/tests/component.spec.js +++ b/packages/server/src/api/routes/tests/component.spec.js @@ -14,7 +14,7 @@ describe("/component", () => { describe("fetch definitions", () => { it("should be able to fetch definitions", async () => { const res = await request - .get(`/${config.getAppId()}/components/definitions`) + .get(`/api/${config.getAppId()}/components/definitions`) .set(config.defaultHeaders()) .expect("Content-Type", /json/) .expect(200) @@ -25,7 +25,7 @@ describe("/component", () => { await checkBuilderEndpoint({ config, method: "GET", - url: `/${config.getAppId()}/components/definitions`, + url: `/api/${config.getAppId()}/components/definitions`, }) }) }) diff --git a/packages/server/src/middleware/authorized.js b/packages/server/src/middleware/authorized.js index c36e3c5b92..554f281d8c 100644 --- a/packages/server/src/middleware/authorized.js +++ b/packages/server/src/middleware/authorized.js @@ -42,10 +42,6 @@ module.exports = (permType, permLevel = null) => async (ctx, next) => { const isAdmin = ADMIN_ROLES.includes(role._id) const isAuthed = ctx.auth.authenticated - if (permType === PermissionTypes.BUILDER) { - return next() - } - const { basePermissions, permissions } = await getUserPermissions( ctx.appId, role._id