From 690ff373cde8da76161d0238c6eb73de7f5a36a0 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 1 Aug 2022 08:50:57 +0100 Subject: [PATCH 1/2] ensure auth access for builder and admins --- .../src/pages/builder/apps/index.svelte | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/packages/builder/src/pages/builder/apps/index.svelte b/packages/builder/src/pages/builder/apps/index.svelte index b358e3bde0..c9ff4c9242 100644 --- a/packages/builder/src/pages/builder/apps/index.svelte +++ b/packages/builder/src/pages/builder/apps/index.svelte @@ -43,26 +43,28 @@ ) let userApps = [] $: publishedApps = $apps.filter(publishedAppsOnly) - + $: console.log($auth.user) $: { if (!Object.keys($auth.user?.roles).length && $auth.user?.userGroups) { - userApps = $auth.user?.builder?.global - ? publishedApps - : publishedApps.filter(app => { - return userGroups.find(group => { - return Object.keys(group.roles) - .map(role => apps.extractAppId(role)) - .includes(app.appId) + userApps = + $auth.user?.builder?.global || $auth.user?.admin?.global + ? publishedApps + : publishedApps.filter(app => { + return userGroups.find(group => { + return Object.keys(group.roles) + .map(role => apps.extractAppId(role)) + .includes(app.appId) + }) }) - }) } else { - userApps = $auth.user?.builder?.global - ? publishedApps - : publishedApps.filter(app => - Object.keys($auth.user?.roles) - .map(x => apps.extractAppId(x)) - .includes(app.appId) - ) + userApps = + $auth.user?.builder?.global || $auth.user?.admin?.global + ? publishedApps + : publishedApps.filter(app => + Object.keys($auth.user?.roles) + .map(x => apps.extractAppId(x)) + .includes(app.appId) + ) } } From a497aa8b8e7c835b10763c6c0701b87b12b756c1 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 1 Aug 2022 08:54:19 +0100 Subject: [PATCH 2/2] remove log --- packages/builder/src/pages/builder/apps/index.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/apps/index.svelte b/packages/builder/src/pages/builder/apps/index.svelte index c9ff4c9242..1f5a761a42 100644 --- a/packages/builder/src/pages/builder/apps/index.svelte +++ b/packages/builder/src/pages/builder/apps/index.svelte @@ -43,7 +43,7 @@ ) let userApps = [] $: publishedApps = $apps.filter(publishedAppsOnly) - $: console.log($auth.user) + $: { if (!Object.keys($auth.user?.roles).length && $auth.user?.userGroups) { userApps =