From ee544773572ebd3352f6bd3d3ce6676ac826857e Mon Sep 17 00:00:00 2001 From: febbraiod Date: Thu, 29 Aug 2024 14:14:42 -0400 Subject: [PATCH] Account for impersonation more thoroughly in LockoutPanel messaging --- desktop/appcontainer/LockoutPanel.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/desktop/appcontainer/LockoutPanel.ts b/desktop/appcontainer/LockoutPanel.ts index 6eaba51cc..f85e84b34 100644 --- a/desktop/appcontainer/LockoutPanel.ts +++ b/desktop/appcontainer/LockoutPanel.ts @@ -39,14 +39,18 @@ const unauthorizedMessage = hoistCmp.factory({ render({model}) { const {identityService} = XH, {appSpec, appStateModel} = model, + {isImpersonating} = identityService, user = XH.getUser(), + authMsg = isImpersonating + ? `You are impersonating ${user.username}` + : `You are logged in as ${user.username}`, roleMsg = isEmpty(user.roles) ? 'no roles assigned' : `the roles [${user.roles.join(', ')}]`; return div( p(appStateModel.accessDeniedMessage ?? ''), - p(`You are logged in as ${user.username} and have ${roleMsg}.`), + p(`${authMsg} and have ${roleMsg}.`), p({ item: appSpec.lockoutMessage, omit: !appSpec.lockoutMessage @@ -60,7 +64,7 @@ const unauthorizedMessage = hoistCmp.factory({ }), hspacer(5), button({ - omit: !identityService.isImpersonating, + omit: !isImpersonating, icon: Icon.impersonate(), text: 'End Impersonation', minimal: false,