From bab4ac2234ed7f3cfeaaa98b24a0444f40aa4b95 Mon Sep 17 00:00:00 2001 From: Sebastien Bousquet Date: Thu, 30 Nov 2023 17:17:18 +0100 Subject: [PATCH] fix: nullable organisation Fix #51 Fix #52 --- src/app/components/home/home.component.html | 12 +++---- src/app/components/home/home.component.scss | 35 +++++++++++++++------ src/app/services/startup/startup.service.ts | 17 +++++++--- src/settings.yaml | 2 +- 4 files changed, 44 insertions(+), 22 deletions(-) diff --git a/src/app/components/home/home.component.html b/src/app/components/home/home.component.html index c343e8f..2df006f 100644 --- a/src/app/components/home/home.component.html +++ b/src/app/components/home/home.component.html @@ -1,11 +1,11 @@
{{'ARLAS IAM' | translate}}
-
+
-
+
{{'Organisation'| translate}} @@ -24,7 +24,7 @@ {{'Home' | translate}} - person @@ -32,7 +32,7 @@ {{'Users' | translate}} - group @@ -40,7 +40,7 @@ {{'Groups'| translate}} - verified_user @@ -48,7 +48,7 @@ {{'Permissions'| translate}} - rule diff --git a/src/app/components/home/home.component.scss b/src/app/components/home/home.component.scss index 6c27087..9a88ee8 100644 --- a/src/app/components/home/home.component.scss +++ b/src/app/components/home/home.component.scss @@ -4,16 +4,28 @@ background-color: $primaryColor !important; padding: 0 10px !important; color: white; - .orga { - font-size: medium; - font-weight: 300; - padding-right: 15px; - - .current-orga { - width: 150px; - background-color: white; - color: black; - padding: 0 5px; + .right-menu { + display: flex; + align-items: baseline; + gap: 0 5px; + .create-org { + padding-right: 15px; + .add-org { + line-height: 32px; + vertical-align: bottom; + } + } + .orga { + font-size: medium; + font-weight: 300; + padding-right: 15px; + + .current-orga { + width: 150px; + background-color: white; + color: black; + padding: 0 5px; + } } } } @@ -45,6 +57,9 @@ } .mat-list-item { color: #28292b; + &.mat-list-item-disabled { + cursor: not-allowed !important; + } } .mat-list-item-content { margin: 15px !important; diff --git a/src/app/services/startup/startup.service.ts b/src/app/services/startup/startup.service.ts index a49ddfe..8e73737 100644 --- a/src/app/services/startup/startup.service.ts +++ b/src/app/services/startup/startup.service.ts @@ -87,15 +87,22 @@ export class IamStartupService { next: loginData => { if (!!loginData) { const storedArlasOrganisation = this.arlasIamService.getOrganisation(); - const org = !!storedArlasOrganisation ? storedArlasOrganisation : loginData.user?.organisations[0]?.name; + const org = !!storedArlasOrganisation ? storedArlasOrganisation + : (!!loginData.user?.organisations[0] ? loginData.user?.organisations[0].name : null); this.arlasIamService.setHeaders(org, loginData.accessToken); + const iamHeader = { + Authorization: 'Bearer ' + loginData.accessToken, + }; + // Set the org filter only if the organisation is defined + if (!!org) { + // @ts-ignore + iamHeader['arlas-org-filter'] = org; + } + this.managerService.setOptions({ - headers: { - Authorization: 'Bearer ' + loginData.accessToken, - 'arlas-org-filter': org - } + headers: iamHeader }); } return Promise.resolve(data); diff --git a/src/settings.yaml b/src/settings.yaml index 75f9166..8f82a11 100644 --- a/src/settings.yaml +++ b/src/settings.yaml @@ -4,4 +4,4 @@ authentication: force_connect: false use_discovery: false threshold: 60000 - url: https://arlas.crts-staff.local/arlas_iam_server + url: http://localhost:9997/arlas_iam_server