From d0157fa0e561cddff9af8a0a44f1b26fd7c8f929 Mon Sep 17 00:00:00 2001 From: sgiannopoulos Date: Tue, 9 Jan 2024 18:28:04 +0200 Subject: [PATCH] bug fixes --- .../core/src/main/java/eu/eudat/audit/AuditableAction.java | 3 +++ .../java/eu/eudat/controllers/v2/PrincipalController.java | 7 ++++--- dmp-frontend/src/app/core/services/auth/auth.service.ts | 2 +- .../src/app/core/services/http/principal.service.ts | 3 ++- .../java/eu/old/eudat/migration/UserMigrationService.java | 2 +- 5 files changed, 11 insertions(+), 6 deletions(-) diff --git a/dmp-backend/core/src/main/java/eu/eudat/audit/AuditableAction.java b/dmp-backend/core/src/main/java/eu/eudat/audit/AuditableAction.java index a85699e91..8297c8d42 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/audit/AuditableAction.java +++ b/dmp-backend/core/src/main/java/eu/eudat/audit/AuditableAction.java @@ -137,4 +137,7 @@ public class AuditableAction { public static final EventId Maintenance_GenerateElastic = new EventId(220000, "Maintenance_GenerateElastic"); public static final EventId Maintenance_ClearElastic = new EventId(230000, "Maintenance_ClearElastic"); + public static final EventId Principal_Lookup = new EventId(240000, "Principal_Lookup"); + + } diff --git a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/PrincipalController.java b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/PrincipalController.java index c50e9f156..158e3996b 100644 --- a/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/PrincipalController.java +++ b/dmp-backend/web/src/main/java/eu/eudat/controllers/v2/PrincipalController.java @@ -1,5 +1,6 @@ package eu.eudat.controllers.v2; +import eu.eudat.audit.AuditableAction; import eu.eudat.models.data.dataset.DatasetOverviewModel; import eu.eudat.models.data.helpers.responses.ResponseItem; import eu.eudat.models.v2.AccountBuilder; @@ -40,7 +41,7 @@ public class PrincipalController { } @RequestMapping(path = "me", method = RequestMethod.GET ) - public ResponseEntity me(FieldSet fieldSet) throws InvalidApplicationException { + public Account me(FieldSet fieldSet) throws InvalidApplicationException { logger.debug("me"); if (fieldSet == null || fieldSet.isEmpty()) { @@ -68,10 +69,10 @@ public class PrincipalController { Account me = this.accountBuilder.build(fieldSet, principal); - //this.auditService.track(AuditableAction.Principal_Lookup); + this.auditService.track(AuditableAction.Principal_Lookup); //auditService.trackIdentity(AuditableAction.IdentityTracking_Action); - return ResponseEntity.status(HttpStatus.OK).body(new ResponseItem().status(ApiMessageCode.NO_MESSAGE).payload(me)); + return me; } } diff --git a/dmp-frontend/src/app/core/services/auth/auth.service.ts b/dmp-frontend/src/app/core/services/auth/auth.service.ts index 72eaee247..be4e7ebfc 100644 --- a/dmp-frontend/src/app/core/services/auth/auth.service.ts +++ b/dmp-frontend/src/app/core/services/auth/auth.service.ts @@ -143,7 +143,7 @@ export class AuthService extends BaseService { this.accessToken ? this.principalService.me(httpParams) : of(null) ])), map((item) => { - this.currentAccount(item[0]?.payload); + this.currentAccount(item[0]); return true; }) ); diff --git a/dmp-frontend/src/app/core/services/http/principal.service.ts b/dmp-frontend/src/app/core/services/http/principal.service.ts index 50b9cc5b5..a33ac37f8 100644 --- a/dmp-frontend/src/app/core/services/http/principal.service.ts +++ b/dmp-frontend/src/app/core/services/http/principal.service.ts @@ -2,7 +2,8 @@ import { Injectable } from '@angular/core'; import { AppAccount } from '@app/core/model/auth/principal'; import { Observable } from 'rxjs'; import { ConfigurationService } from '../configuration/configuration.service'; -import { BaseHttpV2Service } from './base-http-v2.service'; +import { BaseHttpV2Service } from '../http/base-http-v2.service'; +import { map } from 'rxjs/operators'; @Injectable() export class PrincipalService { diff --git a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/UserMigrationService.java b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/UserMigrationService.java index 3886e9767..cf4f6ba7a 100644 --- a/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/UserMigrationService.java +++ b/dmp-migration-tool/web/src/main/java/eu/old/eudat/migration/UserMigrationService.java @@ -73,7 +73,7 @@ public class UserMigrationService { String avatarUrl = ""; String culture = "en-001"; String language = "en"; - String timezone = "en"; + String timezone = "UTC"; String roleOrganization = ""; UUID organizationId = null; if (oldUser != null){