From c38bce64c0c41cb855eaa55050c47e5f12fd9f5e Mon Sep 17 00:00:00 2001 From: Johannes Doberer Date: Tue, 3 Sep 2019 13:44:14 +0200 Subject: [PATCH 1/4] user menu without authorization --- core/src/Authorization.html | 20 ++++++++++++++------ core/src/navigation/TopNav.html | 6 +++++- docs/navigation-parameters-reference.md | 4 ++-- 3 files changed, 21 insertions(+), 9 deletions(-) diff --git a/core/src/Authorization.html b/core/src/Authorization.html index 632fa501ed..d4c2740edd 100644 --- a/core/src/Authorization.html +++ b/core/src/Authorization.html @@ -13,6 +13,7 @@ >{userInfo.name ? userInfo.name : userInfo.email} {/if} + {/if} {#each profileNav.items as profileItem}
  • {/each} + {#if isAuthorizationEnabled}
  • {#if profileNav.logout.icon} @@ -52,11 +54,12 @@ {$getTranslation(profileNav.logout.label)}
  • - {:else} + {#if !isLoggedIn}
  • Login
  • {/if} + {/if} {/if} @@ -131,9 +134,12 @@ }, async oncreate() { if (!LuigiAuth.isAuthorizationEnabled()) { + this.set({ isAuthorizationEnabled: false }); + this.setProfileNavData(); return; + } else { + this.set({ isAuthorizationEnabled: true }); } - const idpProviderName = LuigiConfig.getConfigValue('auth.use'); const idpProviderSettings = LuigiConfig.getConfigValue( `auth.${idpProviderName}` @@ -269,15 +275,17 @@ 'navigation.profile.logout' ); const profileNavData = { - logout: { - ...TOP_NAV_DEFAULTS.logout, - ...logoutItem - }, items: (await LuigiConfig.getConfigValueAsync( 'navigation.profile.items' )) || [] }; + if (this.get().isAuthorizationEnabled) { + profileNavData['logout'] = { + ...TOP_NAV_DEFAULTS.logout, + ...logoutItem + }; + } this.set({ profileNav: profileNavData }); }, ['navigation.profile'] diff --git a/core/src/navigation/TopNav.html b/core/src/navigation/TopNav.html index 0bee124e87..4f32209007 100644 --- a/core/src/navigation/TopNav.html +++ b/core/src/navigation/TopNav.html @@ -248,7 +248,7 @@ {/if} {/if} - {#if authorizationEnabled} + {#if authorizationEnabled || profileItemsAvailable}
    { this.set({ authorizationEnabled: LuigiAuth.isAuthorizationEnabled(), + profileItemsAvailable: LuigiConfig.getConfigValue( + 'navigation.profile.items' + ), autologinEnabled: !Boolean( LuigiConfig.getConfigValue('auth.disableAutoLogin') ), @@ -356,6 +359,7 @@ }, ['navigation'] ); + debugger; this.set({ urlAuthError: AuthHelpers.parseUrlAuthErrors() }); diff --git a/docs/navigation-parameters-reference.md b/docs/navigation-parameters-reference.md index 996c34a65f..395b682d58 100644 --- a/docs/navigation-parameters-reference.md +++ b/docs/navigation-parameters-reference.md @@ -248,7 +248,7 @@ The context switcher is a drop-down list available in the top navigation bar. It ## Profile -The profile section is a configurable drop-down list available in the top navigation bar. Within the configuration, you can override the logout item content and/or add links to Luigi navigation nodes. To do so, add the **profile** property to the **navigation** object using the following optional properties: +The profile section is a configurable drop-down list available in the top navigation bar. Within the configuration, you can override the logout item content (if authorization is configured) and/or add links to Luigi navigation nodes. To do so, add the **profile** property to the **navigation** object using the following optional properties: - **logout** overrides the content of the logout item. - **label** overrides the text for the logout item. The default value is "Sign Out". @@ -262,7 +262,7 @@ The profile section is a configurable drop-down list available in the top naviga - **externalLink** is an object which indicates that the node links to an external URL. If this parameter is defined, the **link** parameter is ignored. It has the following properties: - **sameWindow** defines if the external URL is opened in the current tab or in a new one. The default value for this parameter is `false`. - **url** is the external URL that the link leads to. - +>**NOTE:** Either authorization nor profile property are configured the profile section in the top navigation bar is not visible. ## Product switcher From 75b63d7217b3abed360c24a7b945b154a103e262 Mon Sep 17 00:00:00 2001 From: JohannesDoberer Date: Thu, 5 Sep 2019 11:40:27 +0200 Subject: [PATCH 2/4] docu improvements --- docs/navigation-parameters-reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/navigation-parameters-reference.md b/docs/navigation-parameters-reference.md index 395b682d58..a24284f34a 100644 --- a/docs/navigation-parameters-reference.md +++ b/docs/navigation-parameters-reference.md @@ -262,7 +262,7 @@ The profile section is a configurable drop-down list available in the top naviga - **externalLink** is an object which indicates that the node links to an external URL. If this parameter is defined, the **link** parameter is ignored. It has the following properties: - **sameWindow** defines if the external URL is opened in the current tab or in a new one. The default value for this parameter is `false`. - **url** is the external URL that the link leads to. ->**NOTE:** Either authorization nor profile property are configured the profile section in the top navigation bar is not visible. +>**NOTE:** Neither authorization nor profile property are configured if the profile section in the top navigation bar is not visible. ## Product switcher From a894c66c96a756142a13064e5d70ec6ed890d116 Mon Sep 17 00:00:00 2001 From: Johannes Doberer Date: Thu, 5 Sep 2019 12:37:21 +0200 Subject: [PATCH 3/4] doku fix --- docs/navigation-parameters-reference.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/navigation-parameters-reference.md b/docs/navigation-parameters-reference.md index a24284f34a..a9da0e2793 100644 --- a/docs/navigation-parameters-reference.md +++ b/docs/navigation-parameters-reference.md @@ -278,4 +278,4 @@ The product switcher is a pop-up window available in the top navigation bar. It - **link** defines an absolute link to a **node**. - **externalLink** is an object which indicates that the node links to an external URL. If this parameter is defined, the **link** parameter is ignored. It has the following properties: - **sameWindow** defines if the external URL is opened in the current tab or in a new one. The default value for this parameter is `false`. - - **url** is the external URL that the link leads to. + - **url** is the external URL that the link leads to. \ No newline at end of file From b2cf560bf39cb97cd98c09f7f88661aa793e15cc Mon Sep 17 00:00:00 2001 From: Johannes Doberer Date: Fri, 6 Sep 2019 06:21:03 +0200 Subject: [PATCH 4/4] removed debugger --- core/src/navigation/TopNav.html | 1 - 1 file changed, 1 deletion(-) diff --git a/core/src/navigation/TopNav.html b/core/src/navigation/TopNav.html index 3e584b5aa6..228115898f 100644 --- a/core/src/navigation/TopNav.html +++ b/core/src/navigation/TopNav.html @@ -358,7 +358,6 @@ }, ['navigation'] ); - debugger; this.set({ urlAuthError: AuthHelpers.parseUrlAuthErrors() });