From f0cf2b80626e5ad483bfdfd5166fbc6611a17e8e Mon Sep 17 00:00:00 2001 From: Johannes Doberer Date: Wed, 24 Jul 2019 15:09:05 +0200 Subject: [PATCH 01/10] client permissions --- client/src/lifecycleManager.js | 9 +++++++++ client/src/luigi-client.js | 3 +++ core/src/App.html | 20 ++++++++++++++------ core/src/services/iframe.js | 2 +- docs/luigi-client-api.md | 6 ++++++ 5 files changed, 33 insertions(+), 7 deletions(-) diff --git a/client/src/lifecycleManager.js b/client/src/lifecycleManager.js index 7429229c2c..84a586e4a0 100644 --- a/client/src/lifecycleManager.js +++ b/client/src/lifecycleManager.js @@ -235,5 +235,14 @@ class LifecycleManager extends LuigiClientBase { getPathParams() { return this.currentContext.pathParams; } + + /** + * Returns the current client permissions as specified on the navigation node. (See [Node parameters](navigation-parameters-reference.md).) + * @returns {Object} client permissions as specified on the navigation node. + * @memberof Lifecycle + */ + getClientPermissions() { + return this.currentContext.internal.clientPermissions; + } } export const lifecycleManager = new LifecycleManager(); diff --git a/client/src/luigi-client.js b/client/src/luigi-client.js index 91ea790559..10775e1645 100644 --- a/client/src/luigi-client.js +++ b/client/src/luigi-client.js @@ -34,6 +34,9 @@ class LuigiClient { getPathParams() { return lifecycleManager.getPathParams(); } + getClientPermissions() { + return lifecycleManager.getClientPermissions(); + } /** * @private */ diff --git a/core/src/App.html b/core/src/App.html index d0d041f5f9..04327f18f3 100644 --- a/core/src/App.html +++ b/core/src/App.html @@ -194,7 +194,9 @@ pathParams: JSON.stringify( Object.assign({}, config.pathParams || component.get().pathParams) ), - internal: JSON.stringify(component.prepareInternalData(config.modal)), + internal: JSON.stringify( + component.prepareInternalData(config.modal, config) + ), authData: AuthHelpers.getStoredAuthData() }; IframeHelpers.sendMessageToIframe(config.iframe, message); @@ -301,7 +303,7 @@ }; LuigiI18N.addCurrentLocaleChangeListener(locale => { - const message = { + const message = { msg: 'luigi.current-locale-changed', currentLocale: locale }; @@ -534,13 +536,18 @@ } if ('luigi.ux.set-current-locale' === e.data.msg) { - if (iframe.luigi.clientPermissions && iframe.luigi.clientPermissions.changeCurrentLocale) { + if ( + iframe.luigi.clientPermissions && + iframe.luigi.clientPermissions.changeCurrentLocale + ) { const { currentLocale } = e.data.data; if (currentLocale) { LuigiI18N.setCurrentLocale(currentLocale); } } else { - console.error('Current local change from client declined because client permission changeCurrentLocale is not set for this view.'); + console.error( + 'Current local change from client declined because client permission changeCurrentLocale is not set for this view.' + ); } } }); @@ -587,12 +594,13 @@ addPreserveView(this, data, config); Routing.navigateTo(path); //navigate to the raw path. Any errors/alerts are handled later }, - prepareInternalData(modal = false) { + prepareInternalData(modal = false, config) { return { isNavigateBack: this.get().isNavigateBack, viewStackSize: this.get().preservedViews.length, modal: modal, - currentLocale: LuigiI18N.getCurrentLocale() + currentLocale: LuigiI18N.getCurrentLocale(), + clientPermissions: config.iframe.luigi.clientPermissions }; }, closeLeftNav() { diff --git a/core/src/services/iframe.js b/core/src/services/iframe.js index 2e5a0b0cce..a44a7b3e57 100644 --- a/core/src/services/iframe.js +++ b/core/src/services/iframe.js @@ -264,7 +264,7 @@ class IframeClass { ), nodeParams: JSON.stringify(Object.assign({}, componentData.nodeParams)), pathParams: JSON.stringify(Object.assign({}, componentData.pathParams)), - internal: JSON.stringify(component.prepareInternalData()) + internal: JSON.stringify(component.prepareInternalData(false, config)) }; IframeHelpers.sendMessageToIframe(config.iframe, message); // clear goBackContext and reset navigateBack after sending it to the client diff --git a/docs/luigi-client-api.md b/docs/luigi-client-api.md index 5f2ecb2aa4..cb3f848f31 100644 --- a/docs/luigi-client-api.md +++ b/docs/luigi-client-api.md @@ -75,6 +75,12 @@ All path parameters in the current navigation path (as defined by the active URL Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** path parameters, where the object property name is the path parameter name without the prefix, and its value is the actual value of the path parameter. For example `{productId: 1234, ...}` +### getClientPermissions + +Returns the current client permissions as specified on the navigation node. (See [Node parameters](navigation-parameters-reference.md).) + +Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** client permissions as specified on the navigation node. + ## linkManager The Link Manager allows you to navigate to another route. Use it instead of an internal router to: From a7dcbd3cbf561501187d3d3ec50a18ef05790b48 Mon Sep 17 00:00:00 2001 From: Johannes Doberer Date: Wed, 24 Jul 2019 16:40:49 +0200 Subject: [PATCH 02/10] added missing import --- core/src/services/routing.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/core/src/services/routing.js b/core/src/services/routing.js index 77936ed2a6..40339d821a 100644 --- a/core/src/services/routing.js +++ b/core/src/services/routing.js @@ -1,7 +1,11 @@ // Methods related to the routing. They mostly end up changing the iframe view which is handled by `iframe.js` file; // Please consider adding any new methods to 'routing-helpers' if they don't require anything from this file. import { Navigation } from '../navigation/services/navigation'; -import { GenericHelpers, RoutingHelpers } from '../utilities/helpers'; +import { + GenericHelpers, + RoutingHelpers, + IframeHelpers +} from '../utilities/helpers'; import { LuigiConfig } from '../core-api'; import { Iframe } from './iframe'; import { NAVIGATION_DEFAULTS } from './../utilities/luigi-config-defaults'; From b3ee33663c0055588204c004c5930b8b5926079b Mon Sep 17 00:00:00 2001 From: "Kurajsky, Peter" Date: Thu, 25 Jul 2019 11:46:30 +0200 Subject: [PATCH 03/10] kleinigkeit --- core/package.json | 2 +- core/src/App.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/package.json b/core/package.json index 1365e2d6b3..b6c58d00de 100644 --- a/core/package.json +++ b/core/package.json @@ -53,7 +53,7 @@ "test:watch": "npm run test -- --watch", "bundlesize": "npm run bundle && bundlesize", "docu": "npm run docu:validate && npm run docu:generate:config && npm run docu:generate:dom-elements && npm run docu:generate:auth && npm run docu:generate:navigation && npm run docu:generate:i18n", - "docu:validate": "documentation lint --shallow src/core-api/config.js src/core-api/elements.js src/core-api/auth.js src/core-api/navigation.js src/core-api/i18n.j", + "docu:validate": "documentation lint --shallow src/core-api/config.js src/core-api/elements.js src/core-api/auth.js src/core-api/navigation.js src/core-api/i18n.js", "docu:generate:config": "documentation readme src/core-api/config.js --shallow -f md --section='Luigi Config' --readme-file=../docs/luigi-core-api.md --markdown-toc=false --github false --quiet", "docu:generate:dom-elements": "documentation readme src/core-api/dom-elements.js --shallow -f md --section='Luigi.elements()' --readme-file=../docs/luigi-core-api.md --markdown-toc=false --github false --quiet", "docu:generate:auth": "documentation readme src/core-api/auth.js --shallow -f md --section='Luigi.auth()' --readme-file=../docs/luigi-core-api.md --markdown-toc=false --github false --quiet", diff --git a/core/src/App.html b/core/src/App.html index 04327f18f3..bfd251cc3f 100644 --- a/core/src/App.html +++ b/core/src/App.html @@ -600,7 +600,7 @@ viewStackSize: this.get().preservedViews.length, modal: modal, currentLocale: LuigiI18N.getCurrentLocale(), - clientPermissions: config.iframe.luigi.clientPermissions + clientPermissions: config.iframe.luigi.nextViewUrl ? config.iframe.luigi.nextClientPermissions : config.iframe.luigi.clientPermissions }; }, closeLeftNav() { From 24fd86ac9e19747e174a9d2bd717f753d468907a Mon Sep 17 00:00:00 2001 From: Johannes Doberer Date: Thu, 25 Jul 2019 16:12:05 +0200 Subject: [PATCH 04/10] tets for clientPermissions --- client/luigi-client.d.ts | 7 +++++++ .../luigi-client-ux-manager-features.spec.js | 16 ++++++++++++++++ .../src/app/project/project.component.html | 2 ++ .../src/app/project/project.component.ts | 7 +++++++ .../luigi-config/extended/projectDetailNav.js | 6 ++++++ 5 files changed, 38 insertions(+) diff --git a/client/luigi-client.d.ts b/client/luigi-client.d.ts index 24fb2b29f2..887ef0cc7e 100644 --- a/client/luigi-client.d.ts +++ b/client/luigi-client.d.ts @@ -34,6 +34,10 @@ export declare interface NodeParams { [key: string]: string; } +export declare interface ClientPermissions { + [key: string]: any; +} + export declare interface AlertSettings { text?: string; type: 'info' | 'success' | 'warning' | 'error'; @@ -304,6 +308,9 @@ export type getNodeParams = () => NodeParams; export function getPathParams(): PathParams; export type getPathParams = () => PathParams; +export function getClientPermissions(): ClientPermissions; +export type getClientPermissions = () => ClientPermissions; + /** * The Link Manager allows you to navigate to another route. Use it instead of an internal router to: - Route inside micro front-ends. diff --git a/core/examples/luigi-sample-angular/e2e/tests/luigi-client-ux-manager-features.spec.js b/core/examples/luigi-sample-angular/e2e/tests/luigi-client-ux-manager-features.spec.js index 66d67683c1..22532a8a94 100644 --- a/core/examples/luigi-sample-angular/e2e/tests/luigi-client-ux-manager-features.spec.js +++ b/core/examples/luigi-sample-angular/e2e/tests/luigi-client-ux-manager-features.spec.js @@ -316,6 +316,7 @@ describe('Luigi client ux manager features', () => { cy.get('[data-cy=luigi-alert]').should('not.exist'); }); }); + describe('Luigi Client Localization', () => { it('set localization in client', () => { cy.goToUxManagerMethods($iframeBody); @@ -336,6 +337,21 @@ describe('Luigi client ux manager features', () => { .find('[data-cy=luigi-current-locale]') .should('contain', "'pl_PL'"); }); + it('clientPermissions: check if set localization in client is disabled', () => { + cy.visit('/projects/pr1/clientPermissionsTets') + .get('.iframeContainer iframe') + .then(function($iframe) { + const $body = $iframe.contents().find('body'); + + cy.wrap($body) + .find('[data-cy=luigi-input-locale]') + .should('be.disabled'); + + cy.wrap($body) + .find('[data-cy=set-current-locale]') + .should('be.disabled'); + }); + }); }); }); }); diff --git a/core/examples/luigi-sample-angular/src/app/project/project.component.html b/core/examples/luigi-sample-angular/src/app/project/project.component.html index ec825308f6..285d913c88 100644 --- a/core/examples/luigi-sample-angular/src/app/project/project.component.html +++ b/core/examples/luigi-sample-angular/src/app/project/project.component.html @@ -146,6 +146,7 @@

LuigiClient uxManager methods

name="locale" placeholder="" data-cy="luigi-input-locale" + [disabled]="!canChangeLocale" /> @@ -155,6 +156,7 @@

LuigiClient uxManager methods

class="fd-button" data-cy="set-current-locale" (click)="setCurrentLocale()" + [disabled]="!canChangeLocale" > Set Current Locale diff --git a/core/examples/luigi-sample-angular/src/app/project/project.component.ts b/core/examples/luigi-sample-angular/src/app/project/project.component.ts index 924a93c206..8ea4227d61 100644 --- a/core/examples/luigi-sample-angular/src/app/project/project.component.ts +++ b/core/examples/luigi-sample-angular/src/app/project/project.component.ts @@ -10,6 +10,7 @@ import { Subscription } from 'rxjs'; import { linkManager, uxManager, + getClientPermissions, addContextUpdateListener, removeContextUpdateListener } from '@kyma-project/luigi-client'; @@ -40,6 +41,7 @@ export class ProjectComponent implements OnInit, OnDestroy { public alertTypes = ['success', 'info', 'warning', 'error']; public isDirty = false; public currentLocale = ''; + public canChangeLocale = false; public constructor( private activatedRoute: ActivatedRoute, @@ -84,6 +86,9 @@ export class ProjectComponent implements OnInit, OnDestroy { this.projectId = ctx.context.currentProject; this.preservedViewCallbackContext = ctx.context.goBackContext; this.currentLocale = uxManager().getCurrentLocale(); + this.canChangeLocale = + getClientPermissions() && + getClientPermissions().changeCurrentLocale; // Since Luigi runs outside of Zone.js, changes need // to be updated manually // Be sure to check for destroyed ChangeDetectorRef, @@ -104,6 +109,8 @@ export class ProjectComponent implements OnInit, OnDestroy { // this.projectId = updatedContext.currentProject; // this.preservedViewCallbackContext = updatedContext.goBackContext; this.currentLocale = uxManager().getCurrentLocale(); + this.canChangeLocale = + getClientPermissions() && getClientPermissions().changeCurrentLocale; // Be sure to check for destroyed ChangeDetectorRef, // else you get runtime Errors if (!this.cdr['destroyed']) { diff --git a/core/examples/luigi-sample-angular/src/luigi-config/extended/projectDetailNav.js b/core/examples/luigi-sample-angular/src/luigi-config/extended/projectDetailNav.js index 30dbe2a3d2..c9e7f9ca54 100644 --- a/core/examples/luigi-sample-angular/src/luigi-config/extended/projectDetailNav.js +++ b/core/examples/luigi-sample-angular/src/luigi-config/extended/projectDetailNav.js @@ -64,6 +64,12 @@ export const projectDetailNavStructure = projectId => [ viewUrl: '/sampleapp.html#/projects/' + projectId + '/developers', icon: '/assets/favicon-sap.ico' }, + { + pathSegment: 'clientPermissionsTets', + label: 'ClientPermissionsTets', + viewUrl: '/sampleapp.html#/projects/pr1', + hideFromNav: true + }, { pathSegment: 'on-node-activation', label: 'Node with node activation hook', From 7821144b85b9b7c0d3b628d3038a98d9d50b340e Mon Sep 17 00:00:00 2001 From: Johannes Doberer Date: Fri, 26 Jul 2019 09:35:01 +0200 Subject: [PATCH 05/10] merge conflicts --- core/src/App.html | 2 +- core/src/services/iframe.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/core/src/App.html b/core/src/App.html index 16254f5fa0..36b7fc181b 100644 --- a/core/src/App.html +++ b/core/src/App.html @@ -616,7 +616,7 @@ addPreserveView(this, data, config); Routing.navigateTo(path); //navigate to the raw path. Any errors/alerts are handled later }, - prepareInternalData(config = {}) { + prepareInternalData(config) { const internalData = { isNavigateBack: this.get().isNavigateBack, viewStackSize: this.get().preservedViews.length, diff --git a/core/src/services/iframe.js b/core/src/services/iframe.js index d40a0cdea3..4f5070dae5 100644 --- a/core/src/services/iframe.js +++ b/core/src/services/iframe.js @@ -278,7 +278,7 @@ class IframeClass { ), nodeParams: JSON.stringify(Object.assign({}, componentData.nodeParams)), pathParams: JSON.stringify(Object.assign({}, componentData.pathParams)), - internal: JSON.stringify(component.prepareInternalData(false, config)) + internal: JSON.stringify(component.prepareInternalData(config)) }; IframeHelpers.sendMessageToIframe(config.iframe, message); // clear goBackContext and reset navigateBack after sending it to the client From ec10fe5cc2b9ecb3b4394f0d55a610e021c37862 Mon Sep 17 00:00:00 2001 From: Johannes Doberer Date: Fri, 26 Jul 2019 11:13:28 +0200 Subject: [PATCH 06/10] docu improvements --- client/src/lifecycleManager.js | 4 ++-- docs/luigi-client-api.md | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/lifecycleManager.js b/client/src/lifecycleManager.js index 84a586e4a0..87f6149187 100644 --- a/client/src/lifecycleManager.js +++ b/client/src/lifecycleManager.js @@ -237,8 +237,8 @@ class LifecycleManager extends LuigiClientBase { } /** - * Returns the current client permissions as specified on the navigation node. (See [Node parameters](navigation-parameters-reference.md).) - * @returns {Object} client permissions as specified on the navigation node. + * Returns the current client permissions as specified in the navigation node. For details, see [Node parameters](navigation-parameters-reference.md). + * @returns {Object} client permissions as specified in the navigation node. * @memberof Lifecycle */ getClientPermissions() { diff --git a/docs/luigi-client-api.md b/docs/luigi-client-api.md index b394447779..4c17e4d2b9 100644 --- a/docs/luigi-client-api.md +++ b/docs/luigi-client-api.md @@ -77,9 +77,9 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### getClientPermissions -Returns the current client permissions as specified on the navigation node. (See [Node parameters](navigation-parameters-reference.md).) +Returns the current client permissions as specified in the navigation node. For details, see [Node parameters](navigation-parameters-reference.md). -Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** client permissions as specified on the navigation node. +Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** client permissions as specified in the navigation node. ## linkManager From 3207fe19c71f4251a6a6bad09b3892f9ec69e3d8 Mon Sep 17 00:00:00 2001 From: Johannes Doberer Date: Fri, 26 Jul 2019 15:24:47 +0200 Subject: [PATCH 07/10] test --- .../luigi-client-ux-manager-features.spec.js | 27 +++++++++---------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/core/examples/luigi-sample-angular/e2e/tests/luigi-client-ux-manager-features.spec.js b/core/examples/luigi-sample-angular/e2e/tests/luigi-client-ux-manager-features.spec.js index 22532a8a94..66b66479c7 100644 --- a/core/examples/luigi-sample-angular/e2e/tests/luigi-client-ux-manager-features.spec.js +++ b/core/examples/luigi-sample-angular/e2e/tests/luigi-client-ux-manager-features.spec.js @@ -337,21 +337,20 @@ describe('Luigi client ux manager features', () => { .find('[data-cy=luigi-current-locale]') .should('contain', "'pl_PL'"); }); + it('clientPermissions: check if set localization in client is disabled', () => { - cy.visit('/projects/pr1/clientPermissionsTets') - .get('.iframeContainer iframe') - .then(function($iframe) { - const $body = $iframe.contents().find('body'); - - cy.wrap($body) - .find('[data-cy=luigi-input-locale]') - .should('be.disabled'); - - cy.wrap($body) - .find('[data-cy=set-current-locale]') - .should('be.disabled'); - }); + cy.visit('/projects/pr1/clientPermissionsTets').getIframeBody().then(body => { + + cy.wrap(body) + .find('[data-cy=luigi-input-locale]') + .should('be.disabled'); + + cy.wrap(body) + .find('[data-cy=set-current-locale]') + .should('be.disabled'); + + }); }); }); }); -}); + From b9dc12ccb8bdd037ce844cfd27f822afdfacc303 Mon Sep 17 00:00:00 2001 From: Johannes Doberer Date: Fri, 26 Jul 2019 15:46:55 +0200 Subject: [PATCH 08/10] test fix --- .../luigi-client-ux-manager-features.spec.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/core/examples/luigi-sample-angular/e2e/tests/luigi-client-ux-manager-features.spec.js b/core/examples/luigi-sample-angular/e2e/tests/luigi-client-ux-manager-features.spec.js index 66b66479c7..904772d9de 100644 --- a/core/examples/luigi-sample-angular/e2e/tests/luigi-client-ux-manager-features.spec.js +++ b/core/examples/luigi-sample-angular/e2e/tests/luigi-client-ux-manager-features.spec.js @@ -339,18 +339,18 @@ describe('Luigi client ux manager features', () => { }); it('clientPermissions: check if set localization in client is disabled', () => { - cy.visit('/projects/pr1/clientPermissionsTets').getIframeBody().then(body => { - - cy.wrap(body) - .find('[data-cy=luigi-input-locale]') - .should('be.disabled'); - - cy.wrap(body) - .find('[data-cy=set-current-locale]') - .should('be.disabled'); - - }); + cy.visit('/projects/pr1/clientPermissionsTets') + .getIframeBody() + .then(body => { + cy.wrap(body) + .find('[data-cy=luigi-input-locale]') + .should('be.disabled'); + + cy.wrap(body) + .find('[data-cy=set-current-locale]') + .should('be.disabled'); + }); }); }); }); - +}); From c3903970520d7ed2dceccfaf40042a921223ce7f Mon Sep 17 00:00:00 2001 From: Johannes Doberer Date: Mon, 29 Jul 2019 12:13:04 +0200 Subject: [PATCH 09/10] small change --- client/luigi-client.d.ts | 5 +++++ client/src/lifecycleManager.js | 4 ++-- .../src/app/project/project.component.ts | 7 ++----- docs/luigi-client-api.md | 2 +- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/client/luigi-client.d.ts b/client/luigi-client.d.ts index 943023e0cc..3471b830a0 100644 --- a/client/luigi-client.d.ts +++ b/client/luigi-client.d.ts @@ -361,6 +361,11 @@ export type getNodeParams = () => NodeParams; export function getPathParams(): PathParams; export type getPathParams = () => PathParams; +/** + * Returns the current client permissions as specified in the navigation node or an empty object. For details, see [Node parameters](navigation-parameters-reference.md). + * @returns {Object} client permissions as specified in the navigation node. + * @memberof Lifecycle + */ export function getClientPermissions(): ClientPermissions; export type getClientPermissions = () => ClientPermissions; diff --git a/client/src/lifecycleManager.js b/client/src/lifecycleManager.js index 87f6149187..2bfbe50633 100644 --- a/client/src/lifecycleManager.js +++ b/client/src/lifecycleManager.js @@ -237,12 +237,12 @@ class LifecycleManager extends LuigiClientBase { } /** - * Returns the current client permissions as specified in the navigation node. For details, see [Node parameters](navigation-parameters-reference.md). + * Returns the current client permissions as specified in the navigation node or an empty object. For details, see [Node parameters](navigation-parameters-reference.md). * @returns {Object} client permissions as specified in the navigation node. * @memberof Lifecycle */ getClientPermissions() { - return this.currentContext.internal.clientPermissions; + return this.currentContext.internal.clientPermissions || {}; } } export const lifecycleManager = new LifecycleManager(); diff --git a/core/examples/luigi-sample-angular/src/app/project/project.component.ts b/core/examples/luigi-sample-angular/src/app/project/project.component.ts index a76dccb347..9311dd1376 100644 --- a/core/examples/luigi-sample-angular/src/app/project/project.component.ts +++ b/core/examples/luigi-sample-angular/src/app/project/project.component.ts @@ -87,9 +87,7 @@ export class ProjectComponent implements OnInit, OnDestroy { this.projectId = ctx.context.currentProject; this.preservedViewCallbackContext = ctx.context.goBackContext; this.currentLocale = uxManager().getCurrentLocale(); - this.canChangeLocale = - getClientPermissions() && - getClientPermissions().changeCurrentLocale; + this.canChangeLocale = getClientPermissions().changeCurrentLocale; // Since Luigi runs outside of Zone.js, changes need // to be updated manually // Be sure to check for destroyed ChangeDetectorRef, @@ -110,8 +108,7 @@ export class ProjectComponent implements OnInit, OnDestroy { // this.projectId = updatedContext.currentProject; // this.preservedViewCallbackContext = updatedContext.goBackContext; this.currentLocale = uxManager().getCurrentLocale(); - this.canChangeLocale = - getClientPermissions() && getClientPermissions().changeCurrentLocale; + this.canChangeLocale = getClientPermissions().changeCurrentLocale; console.log('context updated', this.currentLocale, updatedContext); // Be sure to check for destroyed ChangeDetectorRef, // else you get runtime Errors diff --git a/docs/luigi-client-api.md b/docs/luigi-client-api.md index 4c17e4d2b9..c322aaf20a 100644 --- a/docs/luigi-client-api.md +++ b/docs/luigi-client-api.md @@ -77,7 +77,7 @@ Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/G ### getClientPermissions -Returns the current client permissions as specified in the navigation node. For details, see [Node parameters](navigation-parameters-reference.md). +Returns the current client permissions as specified in the navigation node or an empty object. For details, see [Node parameters](navigation-parameters-reference.md). Returns **[Object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)** client permissions as specified in the navigation node. From ca727de5acbd5b99ea94c0dbeb5802eb12feaa9a Mon Sep 17 00:00:00 2001 From: Johannes Doberer Date: Mon, 29 Jul 2019 13:45:55 +0200 Subject: [PATCH 10/10] revert bug fix --- core/src/services/routing.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/core/src/services/routing.js b/core/src/services/routing.js index 4585edee77..77936ed2a6 100644 --- a/core/src/services/routing.js +++ b/core/src/services/routing.js @@ -1,11 +1,7 @@ // Methods related to the routing. They mostly end up changing the iframe view which is handled by `iframe.js` file; // Please consider adding any new methods to 'routing-helpers' if they don't require anything from this file. import { Navigation } from '../navigation/services/navigation'; -import { - GenericHelpers, - IframeHelpers, - RoutingHelpers -} from '../utilities/helpers'; +import { GenericHelpers, RoutingHelpers } from '../utilities/helpers'; import { LuigiConfig } from '../core-api'; import { Iframe } from './iframe'; import { NAVIGATION_DEFAULTS } from './../utilities/luigi-config-defaults';