From e282ea242d2e3f23d0eb712c85b08f2f120af5d8 Mon Sep 17 00:00:00 2001 From: Val <68596159+valya@users.noreply.github.com> Date: Wed, 29 Nov 2023 11:33:32 +0000 Subject: [PATCH] fix: Return scopes on owner setup endpoint (no-changelog) (#7860) Github issue / Community forum post (link here to close automatically): --- packages/cli/src/controllers/owner.controller.ts | 2 +- packages/cli/test/integration/owner.api.test.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/cli/src/controllers/owner.controller.ts b/packages/cli/src/controllers/owner.controller.ts index a1d4da3bf7..18fd62d858 100644 --- a/packages/cli/src/controllers/owner.controller.ts +++ b/packages/cli/src/controllers/owner.controller.ts @@ -101,7 +101,7 @@ export class OwnerController { void this.internalHooks.onInstanceOwnerSetup({ user_id: userId }); - return this.userService.toPublic(owner, { posthog: this.postHog }); + return this.userService.toPublic(owner, { posthog: this.postHog, withScopes: true }); } @Post('/dismiss-banner') diff --git a/packages/cli/test/integration/owner.api.test.ts b/packages/cli/test/integration/owner.api.test.ts index 93ee3e5b97..2d044ee43a 100644 --- a/packages/cli/test/integration/owner.api.test.ts +++ b/packages/cli/test/integration/owner.api.test.ts @@ -60,6 +60,7 @@ describe('POST /owner/setup', () => { password, isPending, apiKey, + globalScopes, } = response.body.data; expect(validator.isUUID(id)).toBe(true); @@ -72,6 +73,7 @@ describe('POST /owner/setup', () => { expect(globalRole.name).toBe('owner'); expect(globalRole.scope).toBe('global'); expect(apiKey).toBeUndefined(); + expect(globalScopes).not.toHaveLength(0); const storedOwner = await Container.get(UserRepository).findOneByOrFail({ id }); expect(storedOwner.password).not.toBe(newOwnerData.password);