Merge branch 'dmp-refactoring' of https://code-repo.d4science.org/MaDgiK-CITE/argos into dmp-refactoring
This commit is contained in:
commit
094d3c6ccc
|
@ -358,4 +358,24 @@ public class ErrorThesaurusProperties {
|
|||
public void setPrefillingSourceCodeExists(ErrorDescription prefillingSourceCodeExists) {
|
||||
this.prefillingSourceCodeExists = prefillingSourceCodeExists;
|
||||
}
|
||||
|
||||
private ErrorDescription inviteUserAlreadyConfirmed;
|
||||
|
||||
public ErrorDescription getInviteUserAlreadyConfirmed() {
|
||||
return inviteUserAlreadyConfirmed;
|
||||
}
|
||||
|
||||
public void setInviteUserAlreadyConfirmed(ErrorDescription inviteUserAlreadyConfirmed) {
|
||||
this.inviteUserAlreadyConfirmed = inviteUserAlreadyConfirmed;
|
||||
}
|
||||
|
||||
private ErrorDescription requestHasExpired;
|
||||
|
||||
public ErrorDescription getRequestHasExpired() {
|
||||
return requestHasExpired;
|
||||
}
|
||||
|
||||
public void setRequestHasExpired(ErrorDescription requestHasExpired) {
|
||||
this.requestHasExpired = requestHasExpired;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -620,7 +620,7 @@ public class UserServiceImpl implements UserService {
|
|||
}
|
||||
if (action == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{token, ActionConfirmationEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
this.checkActionState(action);
|
||||
this.checkActionState(action, false);
|
||||
|
||||
MergeAccountConfirmationEntity mergeAccountConfirmationEntity = this.xmlHandlingService.fromXmlSafe(MergeAccountConfirmationEntity.class, action.getData());
|
||||
if (mergeAccountConfirmationEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{action.getId(), MergeAccountConfirmationEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
@ -646,7 +646,7 @@ public class UserServiceImpl implements UserService {
|
|||
this.entityManager.reloadTenantFilters();
|
||||
}
|
||||
if (action == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{token, ActionConfirmationEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
this.checkActionState(action);
|
||||
this.checkActionState(action, false);
|
||||
|
||||
MergeAccountConfirmationEntity mergeAccountConfirmationEntity = this.xmlHandlingService.fromXmlSafe(MergeAccountConfirmationEntity.class, action.getData());
|
||||
if (mergeAccountConfirmationEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{action.getId(), MergeAccountConfirmationEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
@ -857,7 +857,7 @@ public class UserServiceImpl implements UserService {
|
|||
}
|
||||
if (action == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{token, ActionConfirmationEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
this.checkActionState(action);
|
||||
this.checkActionState(action, false);
|
||||
|
||||
RemoveCredentialRequestEntity removeCredentialRequestEntity = this.xmlHandlingService.fromXmlSafe(RemoveCredentialRequestEntity.class, action.getData());
|
||||
if (removeCredentialRequestEntity == null) throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{action.getId(), RemoveCredentialRequestEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
@ -903,12 +903,13 @@ public class UserServiceImpl implements UserService {
|
|||
this.keycloakService.addUserToTenantRoleGroup(subjectId, this.tenantScope.getDefaultTenantCode(), this.authorizationConfiguration.getAuthorizationProperties().getTenantUserRole());
|
||||
}
|
||||
|
||||
private void checkActionState(ActionConfirmationEntity action) throws MyApplicationException {
|
||||
private void checkActionState(ActionConfirmationEntity action, boolean isUserInvite) throws MyApplicationException {
|
||||
if (action.getStatus().equals(ActionConfirmationStatus.Accepted)){
|
||||
throw new MyApplicationException("Account is already confirmed!");
|
||||
if (isUserInvite) throw new MyValidationException(this.errors.getInviteUserAlreadyConfirmed().getCode(), this.errors.getInviteUserAlreadyConfirmed().getMessage());
|
||||
else throw new MyApplicationException("Account is already confirmed!");
|
||||
}
|
||||
if (action.getExpiresAt().compareTo(Instant.now()) < 0){
|
||||
throw new MyApplicationException("Token has expired!");
|
||||
throw new MyValidationException(this.errors.getRequestHasExpired().getCode(), this.errors.getRequestHasExpired().getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -998,7 +999,7 @@ public class UserServiceImpl implements UserService {
|
|||
}
|
||||
if (action == null)
|
||||
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{token, ActionConfirmationEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
this.checkActionState(action);
|
||||
this.checkActionState(action, true);
|
||||
|
||||
UserInviteToTenantRequestEntity userInviteToTenantRequest = this.xmlHandlingService.fromXmlSafe(UserInviteToTenantRequestEntity.class, action.getData());
|
||||
if (userInviteToTenantRequest == null)
|
||||
|
|
|
@ -112,4 +112,10 @@ error-thesaurus:
|
|||
message: Reference type exists
|
||||
prefillingSourceCodeExists:
|
||||
code: 141
|
||||
message: Prefilling source code exists
|
||||
message: Prefilling source code exists
|
||||
inviteUserAlreadyConfirmed:
|
||||
code: 142
|
||||
message: Invite user already confirmed
|
||||
requestHasExpired:
|
||||
code: 143
|
||||
message: Request has expired
|
|
@ -39,6 +39,8 @@ export enum ResponseErrorCode {
|
|||
DmpBlueprintNewVersionAlreadyCreatedDraft = 139,
|
||||
ReferenceTypeCodeExists = 140,
|
||||
PrefillingSourceCodeExists = 141,
|
||||
InviteUserAlreadyConfirmed = 142,
|
||||
RequestHasExpired = 143,
|
||||
|
||||
// Notification & Annotation Errors
|
||||
InvalidApiKey = 200,
|
||||
|
@ -147,6 +149,10 @@ export class ResponseErrorCodeHelper {
|
|||
return language.instant("GENERAL.BACKEND-ERRORS.REFERENCE-TYPE-CODE-EXISTS");
|
||||
case ResponseErrorCode.PrefillingSourceCodeExists:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.PREFILLING-SOURCE-CODE-EXISTS");
|
||||
case ResponseErrorCode.InviteUserAlreadyConfirmed:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.INVITE-USER-ALREADY-CONFIRMED");
|
||||
case ResponseErrorCode.RequestHasExpired:
|
||||
return language.instant("GENERAL.BACKEND-ERRORS.REQUEST-HAS-EXPIRED");
|
||||
default:
|
||||
return language.instant("GENERAL.SNACK-BAR.NOT-FOUND");
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
|
||||
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
|
||||
import { UserService } from '@app/core/services/user/user.service';
|
||||
import { BaseComponent } from '@common/base/base.component';
|
||||
|
@ -68,11 +69,12 @@ export class UserInviteConfirmation extends BaseComponent implements OnInit {
|
|||
let errorOverrides = new Map<number, string>();
|
||||
errorOverrides.set(302, this.language.instant('EMAIL-CONFIRMATION.EMAIL-FOUND'));
|
||||
errorOverrides.set(-1, this.language.instant('EMAIL-CONFIRMATION.EXPIRED-EMAIL'));
|
||||
this.httpErrorHandlingService.handleBackedRequestError(errorResponse, errorOverrides)
|
||||
this.httpErrorHandlingService.handleBackedRequestError(errorResponse, errorOverrides, SnackBarNotificationLevel.Error)
|
||||
|
||||
const error: HttpError = this.httpErrorHandlingService.getError(errorResponse);
|
||||
if (error.statusCode === 302) {
|
||||
this.router.navigate([this.routerUtils.generateUrl('home')]);
|
||||
}
|
||||
this.router.navigate([this.routerUtils.generateUrl('home')]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -76,7 +76,9 @@
|
|||
"DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.",
|
||||
"REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.",
|
||||
"PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.",
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once"
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once",
|
||||
"INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed",
|
||||
"REQUEST-HAS-EXPIRED": "Request has expired"
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Kontuz!",
|
||||
|
|
|
@ -76,7 +76,9 @@
|
|||
"DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.",
|
||||
"REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.",
|
||||
"PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.",
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once"
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once",
|
||||
"INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed",
|
||||
"REQUEST-HAS-EXPIRED": "Request has expired"
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Warnung!",
|
||||
|
|
|
@ -76,7 +76,9 @@
|
|||
"DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.",
|
||||
"REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.",
|
||||
"PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.",
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once"
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once",
|
||||
"INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed",
|
||||
"REQUEST-HAS-EXPIRED": "Request has expired"
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Warning!",
|
||||
|
|
|
@ -76,7 +76,9 @@
|
|||
"DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.",
|
||||
"REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.",
|
||||
"PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.",
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once"
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once",
|
||||
"INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed",
|
||||
"REQUEST-HAS-EXPIRED": "Request has expired"
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Atención!",
|
||||
|
|
|
@ -76,7 +76,9 @@
|
|||
"DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.",
|
||||
"REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.",
|
||||
"PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.",
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once"
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once",
|
||||
"INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed",
|
||||
"REQUEST-HAS-EXPIRED": "Request has expired"
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Προσοχή!",
|
||||
|
|
|
@ -76,7 +76,9 @@
|
|||
"DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.",
|
||||
"REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.",
|
||||
"PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.",
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once"
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once",
|
||||
"INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed",
|
||||
"REQUEST-HAS-EXPIRED": "Request has expired"
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Oprez!",
|
||||
|
|
|
@ -76,7 +76,9 @@
|
|||
"DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.",
|
||||
"REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.",
|
||||
"PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.",
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once"
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once",
|
||||
"INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed",
|
||||
"REQUEST-HAS-EXPIRED": "Request has expired"
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Ostrzeżenie!",
|
||||
|
|
|
@ -76,7 +76,9 @@
|
|||
"DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.",
|
||||
"REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.",
|
||||
"PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.",
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once"
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once",
|
||||
"INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed",
|
||||
"REQUEST-HAS-EXPIRED": "Request has expired"
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Atenção!",
|
||||
|
|
|
@ -76,7 +76,9 @@
|
|||
"DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.",
|
||||
"REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.",
|
||||
"PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.",
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once"
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once",
|
||||
"INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed",
|
||||
"REQUEST-HAS-EXPIRED": "Request has expired"
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Upozornenie!",
|
||||
|
|
|
@ -76,7 +76,9 @@
|
|||
"DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.",
|
||||
"REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.",
|
||||
"PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.",
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once"
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once",
|
||||
"INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed",
|
||||
"REQUEST-HAS-EXPIRED": "Request has expired"
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Oprez!",
|
||||
|
|
|
@ -76,7 +76,9 @@
|
|||
"DMP-BLUEPRINT-NEW-VERSION-ALREADY-CREATED-DRAFT": "You have already created a new draft version for this blueprint.",
|
||||
"REFERENCE-TYPE-CODE-EXISTS": "The reference type code you provided already exists. Please choose a different code.",
|
||||
"PREFILLING-SOURCE-CODE-EXISTS": "The prefilling source code you provided already exists. Please choose a different code.",
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once"
|
||||
"DUPLICATE-DMP-USER": "You can't invite authors with same role and plan section more than once",
|
||||
"INVITE-USER-ALREADY-CONFIRMED": "Ιnvitation has already confirmed",
|
||||
"REQUEST-HAS-EXPIRED": "Request has expired"
|
||||
},
|
||||
"FORM-VALIDATION-DISPLAY-DIALOG": {
|
||||
"WARNING": "Uyarı!",
|
||||
|
|
Loading…
Reference in New Issue