Skip to content

Commit

Permalink
Merge pull request #18 from maritimeconnectivity/service-registry-sup…
Browse files Browse the repository at this point in the history
…port

v0.6.0 - Service registry support
  • Loading branch information
JinkiJung authored Jan 16, 2025
2 parents 10dc4b2 + 24a5a9c commit 061cdcb
Show file tree
Hide file tree
Showing 76 changed files with 3,060 additions and 402 deletions.
14 changes: 13 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "management-portal-clr",
"version": "0.0.1",
"version": "0.6.0",
"license": "Apache license 2.0",
"repository": {
"type": "git",
Expand All @@ -27,12 +27,15 @@
"@angular/platform-browser": "^18.2.3",
"@angular/platform-browser-dynamic": "^18.2.3",
"@angular/router": "^18.2.3",
"@bluehalo/ngx-leaflet": "^18.0.2",
"@bluehalo/ngx-leaflet-draw": "^18.0.4",
"@cds/core": "^6.13.0",
"@clr/angular": "^17.3.0",
"@clr/ui": "^17.3.0",
"@ngx-translate/core": "^15.0.0",
"@ngx-translate/http-loader": "^8.0.0",
"@swimlane/ngx-charts": "^20.5.0",
"@terraformer/wkt": "^2.2.1",
"asn1js": "^3.0.5",
"d3-scale": "^4.0.2",
"d3-selection": "^3.0.0",
Expand All @@ -42,11 +45,16 @@
"jszip": "^3.10.1",
"keycloak-angular": "^16.0.1",
"keycloak-js": "^25.0.5",
"leaflet": "^1.9.4",
"leaflet-draw": "^1.0.2",
"lucene-query-string-builder": "^1.0.8",
"pkijs": "^3.2.4",
"pvtsutils": "^1.3.5",
"pvutils": "^1.1.3",
"rxjs": "~7.8.0",
"shortid": "^2.2.16",
"tslib": "^2.3.0",
"wkt": "link:@types/@terraformer/wkt",
"zone.js": "^0.14.10"
},
"devDependencies": {
Expand All @@ -56,7 +64,11 @@
"@types/d3-selection": "^3.0.11",
"@types/d3-shape": "^3.1.6",
"@types/file-saver": "^2.0.7",
"@types/geojson": "^7946.0.14",
"@types/jasmine": "~4.3.0",
"@types/leaflet": "^1.9.14",
"@types/leaflet-draw": "^1.0.11",
"@types/terraformer__wkt": "^2.0.3",
"angular-cli-ghpages": "2.0.3",
"angular-eslint": "18.3.1",
"eslint": "^9.9.1",
Expand Down
121 changes: 121 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ import {HTTP_INTERCEPTORS, HttpClient, provideHttpClient, withInterceptorsFromDi
import {TranslateLoader, TranslateModule} from '@ngx-translate/core';
import { TranslateHttpLoader } from '@ngx-translate/http-loader';
import { NotifierModule } from 'gramli-angular-notifier';
import { BASE_PATH as MIR_BASE_PATH } from './backend-api/identity-registry/variables';
import { BASE_PATH as MSR_BASE_PATH } from './backend-api/service-registry/variables';
import { BASE_PATH as SECOM_SEARCH_BASE_PATH } from './backend-api/secom/variables';
import { AppConfig } from './app.config';
import { AuthInterceptor } from './auth/auth.interceptor';

Expand Down
3 changes: 3 additions & 0 deletions src/app/auth/auth.permission.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ export enum AuthPermissionForMSR {

export const rolesToPermission = (roles: RoleNameEnum[]): AuthPermission => {
let permission = AuthPermission.User;
if (!roles) {
return permission;
}
for (const roleString of roles) {
switch (roleString as RoleNameEnum) {
case RoleNameEnum.ORGADMIN: {
Expand Down
6 changes: 6 additions & 0 deletions src/app/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ export class AuthService {
this.protectFromEmptyToken();
return new Promise<AuthPermission>(async (resolve, reject) => {
const roles = await this.keycloakService.getKeycloakInstance().tokenParsed!["roles"];
if (!roles) {
resolve(AuthPermission.User);
}
resolve(rolesToPermission(roles));
});
}
Expand All @@ -78,6 +81,9 @@ export class AuthService {
if (!this.keycloakService.isLoggedIn())
resolve(false);
this.getUserPermission().then((permission) => {
if (!permission) {
resolve(false);
}
if (hasAdminPermissionInMIR(permission, AuthPermission.SiteAdmin)) { // super admin
resolve(true);
} else if (context === ItemType.User) {
Expand Down
Loading

0 comments on commit 061cdcb

Please sign in to comment.