This repository was archived by the owner on Nov 6, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +27
-3
lines changed
packages/language/global-contexts Expand file tree Collapse file tree 3 files changed +27
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { umbExtensionsRegistry } from '@umbraco-cms/backoffice/extension-registr
88import type { ManifestSection } from '@umbraco-cms/backoffice/extension-registry' ;
99import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api' ;
1010import type { UmbExtensionManifestInitializer } from '@umbraco-cms/backoffice/extension-api' ;
11+ import { UMB_AUTH_CONTEXT } from '@umbraco-cms/backoffice/auth' ;
1112
1213export class UmbBackofficeContext extends UmbContextBase < UmbBackofficeContext > {
1314 #activeSectionAlias = new UmbStringState ( undefined ) ;
@@ -26,7 +27,13 @@ export class UmbBackofficeContext extends UmbContextBase<UmbBackofficeContext> {
2627 this . #allowedSections. setValue ( [ ...sections ] ) ;
2728 } ) ;
2829
29- this . #getVersion( ) ;
30+ // TODO: We need to ensure this request is called every time the user logs in, but this should be done somewhere across the app and not here [JOV]
31+ this . consumeContext ( UMB_AUTH_CONTEXT , ( authContext ) => {
32+ this . observe ( authContext . isAuthorized , ( isAuthorized ) => {
33+ if ( ! isAuthorized ) return ;
34+ this . #getVersion( ) ;
35+ } ) ;
36+ } ) ;
3037 }
3138
3239 async #getVersion( ) {
Original file line number Diff line number Diff line change 77} from '@umbraco-cms/backoffice/extension-registry' ;
88import { UmbServerExtensionRegistrator } from '@umbraco-cms/backoffice/extension-api' ;
99import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element' ;
10+ import { UMB_AUTH_CONTEXT } from '@umbraco-cms/backoffice/auth' ;
1011
1112import './components/index.js' ;
1213
@@ -58,7 +59,15 @@ export class UmbBackofficeElement extends UmbLitElement {
5859 umbExtensionsRegistry . registerMany ( packageModule . extensions ) ;
5960 } ) ;
6061
61- new UmbServerExtensionRegistrator ( this , umbExtensionsRegistry ) . registerPrivateExtensions ( ) ;
62+ const serverExtensions = new UmbServerExtensionRegistrator ( this , umbExtensionsRegistry ) ;
63+
64+ // TODO: We need to ensure this request is called every time the user logs in, but this should be done somewhere across the app and not here [JOV]
65+ this . consumeContext ( UMB_AUTH_CONTEXT , ( authContext ) => {
66+ this . observe ( authContext . isAuthorized , ( isAuthorized ) => {
67+ if ( ! isAuthorized ) return ;
68+ serverExtensions . registerPrivateExtensions ( ) ;
69+ } ) ;
70+ } ) ;
6271 }
6372
6473 render ( ) {
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import type { UmbControllerHost } from '@umbraco-cms/backoffice/controller-api';
55import { UmbContextBase } from '@umbraco-cms/backoffice/class-api' ;
66import { UmbContextToken } from '@umbraco-cms/backoffice/context-api' ;
77import type { UmbApi } from '@umbraco-cms/backoffice/extension-api' ;
8+ import { UMB_AUTH_CONTEXT } from '@umbraco-cms/backoffice/auth' ;
89
910// TODO: Make a store for the App Languages.
1011// TODO: Implement default language end-point, in progress at backend team, so we can avoid getting all languages.
@@ -28,7 +29,14 @@ export class UmbAppLanguageContext extends UmbContextBase<UmbAppLanguageContext>
2829 constructor ( host : UmbControllerHost ) {
2930 super ( host , UMB_APP_LANGUAGE_CONTEXT ) ;
3031 this . #languageCollectionRepository = new UmbLanguageCollectionRepository ( this ) ;
31- this . #observeLanguages( ) ;
32+
33+ // TODO: We need to ensure this request is called every time the user logs in, but this should be done somewhere across the app and not here [JOV]
34+ this . consumeContext ( UMB_AUTH_CONTEXT , ( authContext ) => {
35+ this . observe ( authContext . isAuthorized , ( isAuthorized ) => {
36+ if ( ! isAuthorized ) return ;
37+ this . #observeLanguages( ) ;
38+ } ) ;
39+ } ) ;
3240 }
3341
3442 setLanguage ( unique : string ) {
You can’t perform that action at this time.
0 commit comments