From 011193a3dcdd4f2fc3c094201a0521510c4e3d9c Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Tue, 14 Sep 2021 15:49:59 +0100 Subject: [PATCH] Navigate between budibase and account portal --- .../builder/src/pages/builder/portal/_layout.svelte | 11 +++++++++++ packages/worker/src/api/controllers/global/users.js | 5 +++++ 2 files changed, 16 insertions(+) diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte index 20bdc9cb54..3b1ea47e8b 100644 --- a/packages/builder/src/pages/builder/portal/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/_layout.svelte @@ -12,6 +12,7 @@ } from "@budibase/bbui" import ConfigChecklist from "components/common/ConfigChecklist.svelte" import { organisation, auth } from "stores/portal" + import { admin as adminStore } from "stores/portal" import { onMount } from "svelte" import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte" import ChangePasswordModal from "components/settings/ChangePasswordModal.svelte" @@ -57,6 +58,16 @@ }, ]) } + + // add link to account portal if the user has access + if ($auth.user.account) { + menu = menu.concat([ + { + title: "Account", + href: $adminStore.accountPortalUrl, + }, + ]) + } return menu } diff --git a/packages/worker/src/api/controllers/global/users.js b/packages/worker/src/api/controllers/global/users.js index 7fd367964c..13959273cd 100644 --- a/packages/worker/src/api/controllers/global/users.js +++ b/packages/worker/src/api/controllers/global/users.js @@ -196,6 +196,11 @@ exports.getSelf = async ctx => { } // this will set the body await exports.find(ctx) + + // append the account portal session information if present + if (ctx.user.account) { + ctx.body.account = ctx.user.account + } } exports.updateSelf = async ctx => {