From d1c185047c6b04a1d3660b2e04711deaeb85e3bb Mon Sep 17 00:00:00 2001 From: dariadomagala Date: Fri, 11 Jan 2019 13:54:55 +0100 Subject: [PATCH 1/3] Add and examples docs for anonymous content --- .../src/app/anonymous/anonymous.component.css | 0 .../app/anonymous/anonymous.component.html | 13 +++++++++++ .../src/app/anonymous/anonymous.component.ts | 22 +++++++++++++++++++ .../src/app/app-routing.module.ts | 2 ++ .../src/app/app.module.ts | 4 +++- .../src/assets/extendedConfiguration.js | 17 +++++++++++++- docs/navigation-configuration.md | 1 + 7 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 core/examples/luigi-sample-angular/src/app/anonymous/anonymous.component.css create mode 100644 core/examples/luigi-sample-angular/src/app/anonymous/anonymous.component.html create mode 100644 core/examples/luigi-sample-angular/src/app/anonymous/anonymous.component.ts diff --git a/core/examples/luigi-sample-angular/src/app/anonymous/anonymous.component.css b/core/examples/luigi-sample-angular/src/app/anonymous/anonymous.component.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/core/examples/luigi-sample-angular/src/app/anonymous/anonymous.component.html b/core/examples/luigi-sample-angular/src/app/anonymous/anonymous.component.html new file mode 100644 index 0000000000..2daebdbb05 --- /dev/null +++ b/core/examples/luigi-sample-angular/src/app/anonymous/anonymous.component.html @@ -0,0 +1,13 @@ +
+
+

Anonymous content

+
+
+
+ This page is visible only for users that are not logged in. +
+
+ This page is visible for all users, also those that are not logged in. +
+
+
\ No newline at end of file diff --git a/core/examples/luigi-sample-angular/src/app/anonymous/anonymous.component.ts b/core/examples/luigi-sample-angular/src/app/anonymous/anonymous.component.ts new file mode 100644 index 0000000000..a304ff5c7a --- /dev/null +++ b/core/examples/luigi-sample-angular/src/app/anonymous/anonymous.component.ts @@ -0,0 +1,22 @@ +import { Component, OnInit } from '@angular/core'; +import { Router, ActivatedRoute } from '@angular/router'; + +@Component({ + selector: 'app-anonymous', + templateUrl: './anonymous.component.html', + styleUrls: ['./anonymous.component.css'] +}) +export class AnonymousComponent implements OnInit { + exclusive: false; + + constructor(private route: ActivatedRoute) { + this.route.queryParams.subscribe( + params => { + this.exclusive = params.exclusive; + }, + err => {} + ); + } + + ngOnInit() {} +} diff --git a/core/examples/luigi-sample-angular/src/app/app-routing.module.ts b/core/examples/luigi-sample-angular/src/app/app-routing.module.ts index 2d1498cb3c..2a33a44a62 100644 --- a/core/examples/luigi-sample-angular/src/app/app-routing.module.ts +++ b/core/examples/luigi-sample-angular/src/app/app-routing.module.ts @@ -16,11 +16,13 @@ import { OverviewComponent } from './overview/overview.component'; import { RestrictedComponent } from './restricted/restricted.component'; import { DynamicComponent } from './project/dynamic/dynamic.component'; import { HideSideNavComponent } from './project/hideSideNav/hideSideNav.component'; +import { AnonymousComponent } from './anonymous/anonymous.component'; const routes: Routes = [ { path: 'overview', component: OverviewComponent }, { path: 'settings', component: SettingsComponent }, { path: 'restricted', component: RestrictedComponent }, + { path: 'anonymous', component: AnonymousComponent }, { path: 'projects/:projectId', component: ProjectComponent }, { path: 'projects/:projectId/users', component: UsersComponent }, { diff --git a/core/examples/luigi-sample-angular/src/app/app.module.ts b/core/examples/luigi-sample-angular/src/app/app.module.ts index 0108a45d0c..f77ba5277d 100644 --- a/core/examples/luigi-sample-angular/src/app/app.module.ts +++ b/core/examples/luigi-sample-angular/src/app/app.module.ts @@ -24,6 +24,7 @@ import { LuigiContextService } from './services/luigi-context.service'; import { GroupSettingsComponent } from './project/users/groups/group-details/group-settings/group-settings.component'; import { DynamicComponent } from './project/dynamic/dynamic.component'; import { HideSideNavComponent } from './project/hideSideNav/hideSideNav.component'; +import { AnonymousComponent } from './anonymous/anonymous.component'; @NgModule({ declarations: [ @@ -46,7 +47,8 @@ import { HideSideNavComponent } from './project/hideSideNav/hideSideNav.componen RestrictedComponent, GroupSettingsComponent, DynamicComponent, - HideSideNavComponent + HideSideNavComponent, + AnonymousComponent ], imports: [BrowserModule, FormsModule, AppRoutingModule], providers: [LuigiContextService], diff --git a/core/examples/luigi-sample-angular/src/assets/extendedConfiguration.js b/core/examples/luigi-sample-angular/src/assets/extendedConfiguration.js index b219bc804c..5a1a99bdee 100644 --- a/core/examples/luigi-sample-angular/src/assets/extendedConfiguration.js +++ b/core/examples/luigi-sample-angular/src/assets/extendedConfiguration.js @@ -355,7 +355,7 @@ Luigi.setConfig({ */ auth: { use: 'mockAuth', - disableAutoLogin: false, + disableAutoLogin: true, mockAuth: { authorizeUrl: `${ window.location.origin @@ -495,6 +495,21 @@ Luigi.setConfig({ sameWindow: true } }, + // showing an anonymous content is possible only with auto login disabled + { + pathSegment: 'all-users', + label: 'Visible for all users', + anonymousAccess: true, + viewUrl: '/sampleapp.html#/anonymous', + hideSideNav: true + }, + { + pathSegment: 'anonymous', + label: 'Visible for anonymous users only', + anonymousAccess: 'exclusive', + viewUrl: '/sampleapp.html#/anonymous?exclusive=true', + hideSideNav: true + }, { pathSegment: 'ext', label: 'External Page', diff --git a/docs/navigation-configuration.md b/docs/navigation-configuration.md index ff49817d05..7605435be4 100644 --- a/docs/navigation-configuration.md +++ b/docs/navigation-configuration.md @@ -248,6 +248,7 @@ The node parameters are as follows: - **loadingIndicator.hideAutomatically** disables the automatic hiding of the loading indicator once the micro front-end is loaded. It is only considered if the loading indicator is enabled. It does not apply if the loading indicator is activated manually with the `LuigiClient.uxManager().showLoadingIndicator()` function. If the loading indicator is enabled and automatic hiding is disabled, use `LuigiClient.uxManager().hideLoadingIndicator()` to hide it manually in your micro front-end during the startup. This parameter is enabled by default. - **viewGroup** defines a group of views in the same domain sharing a common security context. This improves performance through reusing the frame. Use **viewGroup** only for the views that use path routing internally. - **icon** is the name of an icon from the [OpenUI](https://openui5.hana.ondemand.com/1.40.10/iconExplorer.html) or a custom link (relative or absolute) to an image displayed next to the Node label in the side navigation or instead of the label in the top navigation. +- **anonymousAccess** defines if the node should be visible for the anonymous user. If **anonymousAccess** is set to _true_, all users will see the node, if it's set to _exclusive_, the node will be visible only for users that are not logged in. It is not propagated to the node's children and is disabled by default. ### Navigation configuration example From d1026a883a9af4f78e4207aac038728dcdaacd84 Mon Sep 17 00:00:00 2001 From: dariadomagala Date: Fri, 11 Jan 2019 14:04:43 +0100 Subject: [PATCH 2/3] Add UI test --- .../luigi-sample-angular/e2e/tests/navigation.spec.js | 10 ++++++++++ .../src/assets/extendedConfiguration.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/core/examples/luigi-sample-angular/e2e/tests/navigation.spec.js b/core/examples/luigi-sample-angular/e2e/tests/navigation.spec.js index 231c685acb..a4d04d7508 100644 --- a/core/examples/luigi-sample-angular/e2e/tests/navigation.spec.js +++ b/core/examples/luigi-sample-angular/e2e/tests/navigation.spec.js @@ -49,6 +49,16 @@ describe('Navigation', () => { .should('exist'); }); + it('Anonymous content', () => { + cy.get('.fd-shellbar') + .contains('Visible for all users') + .should('exist'); + + cy.get('.fd-shellbar') + .contains('Visible for anonymous users only') + .should('not.exist'); + }); + describe('features', () => { it('keepSelectedForChildren', () => { // keep selected for children example diff --git a/core/examples/luigi-sample-angular/src/assets/extendedConfiguration.js b/core/examples/luigi-sample-angular/src/assets/extendedConfiguration.js index 5a1a99bdee..c4518d03d4 100644 --- a/core/examples/luigi-sample-angular/src/assets/extendedConfiguration.js +++ b/core/examples/luigi-sample-angular/src/assets/extendedConfiguration.js @@ -355,7 +355,7 @@ Luigi.setConfig({ */ auth: { use: 'mockAuth', - disableAutoLogin: true, + disableAutoLogin: false, mockAuth: { authorizeUrl: `${ window.location.origin From 71311b53422e14cc8382e81f1b7eae9c992ab060 Mon Sep 17 00:00:00 2001 From: Barbara Date: Fri, 11 Jan 2019 14:58:35 +0100 Subject: [PATCH 3/3] Update docs/navigation-configuration.md Co-Authored-By: dariadomagala <40663133+dariadomagala@users.noreply.github.com> --- docs/navigation-configuration.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/navigation-configuration.md b/docs/navigation-configuration.md index 7605435be4..7af7d91089 100644 --- a/docs/navigation-configuration.md +++ b/docs/navigation-configuration.md @@ -248,7 +248,7 @@ The node parameters are as follows: - **loadingIndicator.hideAutomatically** disables the automatic hiding of the loading indicator once the micro front-end is loaded. It is only considered if the loading indicator is enabled. It does not apply if the loading indicator is activated manually with the `LuigiClient.uxManager().showLoadingIndicator()` function. If the loading indicator is enabled and automatic hiding is disabled, use `LuigiClient.uxManager().hideLoadingIndicator()` to hide it manually in your micro front-end during the startup. This parameter is enabled by default. - **viewGroup** defines a group of views in the same domain sharing a common security context. This improves performance through reusing the frame. Use **viewGroup** only for the views that use path routing internally. - **icon** is the name of an icon from the [OpenUI](https://openui5.hana.ondemand.com/1.40.10/iconExplorer.html) or a custom link (relative or absolute) to an image displayed next to the Node label in the side navigation or instead of the label in the top navigation. -- **anonymousAccess** defines if the node should be visible for the anonymous user. If **anonymousAccess** is set to _true_, all users will see the node, if it's set to _exclusive_, the node will be visible only for users that are not logged in. It is not propagated to the node's children and is disabled by default. +- **anonymousAccess** defines if the node should be visible for the anonymous user. If set to `true`, all users see the node, while if set to `exclusive`, only the users that are not logged in can see it. The property is not propagated to the node's children and is disabled by default. ### Navigation configuration example