diff --git a/dmp-backend/core/src/main/java/eu/eudat/model/persist/NewVersionDmpPersist.java b/dmp-backend/core/src/main/java/eu/eudat/model/persist/NewVersionDmpPersist.java index c704c5ec7..5adc9b923 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/model/persist/NewVersionDmpPersist.java +++ b/dmp-backend/core/src/main/java/eu/eudat/model/persist/NewVersionDmpPersist.java @@ -6,8 +6,11 @@ import eu.eudat.convention.ConventionService; import eu.eudat.data.DmpEntity; import eu.eudat.errorcode.ErrorThesaurusProperties; import org.apache.commons.compress.utils.Lists; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; import org.springframework.context.MessageSource; +import org.springframework.context.annotation.Scope; import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.stereotype.Component; import java.util.Arrays; import java.util.List; @@ -16,6 +19,7 @@ import java.util.UUID; public class NewVersionDmpPersist { private UUID id = null; + public static final String _id = "id"; private String label = null; @@ -85,6 +89,8 @@ public class NewVersionDmpPersist { this.hash = hash; } + @Component(NewVersionDmpPersist.NewVersionDmpPersistValidator.ValidatorName) + @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) public static class NewVersionDmpPersistValidator extends BaseValidator { public static final String ValidatorName = "NewVersionDmpPersistValidator"; diff --git a/dmp-backend/core/src/main/java/eu/eudat/service/dmp/DmpServiceImpl.java b/dmp-backend/core/src/main/java/eu/eudat/service/dmp/DmpServiceImpl.java index c908a3aa7..d276a45cd 100644 --- a/dmp-backend/core/src/main/java/eu/eudat/service/dmp/DmpServiceImpl.java +++ b/dmp-backend/core/src/main/java/eu/eudat/service/dmp/DmpServiceImpl.java @@ -803,7 +803,9 @@ public class DmpServiceImpl implements DmpService { if (userId != null){ user.setUser(userId); this.assignUsers(id, List.of(user), null); - this.sendDmpInvitationExistingUser(user.getUser(), dmp, user.getRole()); + if (this.userScope.getUserId() != userId){ + this.sendDmpInvitationExistingUser(user.getUser(), dmp, user.getRole()); + } }else if (user.getEmail() != null) { this.sendDmpInvitationExternalUser(user.getEmail(),dmp, user.getRole()); } diff --git a/dmp-frontend/src/app/core/services/dmp/dmp.service.ts b/dmp-frontend/src/app/core/services/dmp/dmp.service.ts index 378dc97f0..42e68a55e 100644 --- a/dmp-frontend/src/app/core/services/dmp/dmp.service.ts +++ b/dmp-frontend/src/app/core/services/dmp/dmp.service.ts @@ -85,7 +85,7 @@ export class DmpService { const options = { params: { f: reqFields } }; return this.http - .post(url, item).pipe( + .post(url, item, options).pipe( catchError((error: any) => throwError(error))); } @@ -94,7 +94,7 @@ export class DmpService { const options = { params: { f: reqFields } }; return this.http - .post(url, item).pipe( + .post(url, item, options ).pipe( catchError((error: any) => throwError(error))); } diff --git a/dmp-frontend/src/app/ui/dmp/clone-dialog/dmp-clone-dialog.component.html b/dmp-frontend/src/app/ui/dmp/clone-dialog/dmp-clone-dialog.component.html index 840799134..a6677695d 100644 --- a/dmp-frontend/src/app/ui/dmp/clone-dialog/dmp-clone-dialog.component.html +++ b/dmp-frontend/src/app/ui/dmp/clone-dialog/dmp-clone-dialog.component.html @@ -34,7 +34,7 @@
{{'DMP-CLONE-DIALOG.FIELDS.DESCRIPTIONS-HINT' | translate}}
-
+
@@ -43,7 +43,7 @@
-
+
{{'DMP-CLONE-DIALOG.NO-DESCRIPTIONS' | translate}}
diff --git a/dmp-frontend/src/app/ui/dmp/clone-dialog/dmp-clone-dialog.component.ts b/dmp-frontend/src/app/ui/dmp/clone-dialog/dmp-clone-dialog.component.ts index a42799b5d..4d6228ea0 100644 --- a/dmp-frontend/src/app/ui/dmp/clone-dialog/dmp-clone-dialog.component.ts +++ b/dmp-frontend/src/app/ui/dmp/clone-dialog/dmp-clone-dialog.component.ts @@ -8,6 +8,7 @@ import { BaseComponent } from '@common/base/base.component'; import { TranslateService } from '@ngx-translate/core'; import { takeUntil } from 'rxjs/operators'; import { DmpCloneDialogEditorModel } from './dmp-clone-dialog.editor.model'; +import { DmpEditorResolver } from '../dmp-editor-blueprint/dmp-editor.resolver'; @Component({ selector: 'app-dmp-clone-dialog', @@ -37,7 +38,7 @@ export class CloneDmpDialogComponent extends BaseComponent { } hasDescriptions() { - return this.dmp.descriptions.length > 0; + return this.dmp.descriptions?.length > 0; } close() { @@ -51,7 +52,7 @@ export class CloneDmpDialogComponent extends BaseComponent { confirm() { if (!this.formGroup.valid) { return; } const value: CloneDmpPersist = this.formGroup.value; - this.dmpService.clone(value).pipe(takeUntil(this._destroyed)).subscribe( + this.dmpService.clone(value, DmpEditorResolver.lookupFields()).pipe(takeUntil(this._destroyed)).subscribe( dmp => this.dialogRef.close(dmp), error => this.onCallbackError(error) ); diff --git a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.model.ts b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.model.ts index 6bcd93449..d5eac43b7 100644 --- a/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.model.ts +++ b/dmp-frontend/src/app/ui/dmp/dmp-editor-blueprint/dmp-editor.model.ts @@ -295,25 +295,27 @@ export class DmpBlueprintValueEditorModel implements DmpBlueprintValuePersist { this.fieldId = item.fieldId; this.fieldValue = item.fieldValue; // TODO check typeId field - dmpReferences.forEach(dmpReference => { - if(dmpReference.data.blueprintFieldId == this.fieldId){ - this.references.push({ - data: dmpReference.data, - reference: { - id: dmpReference.reference.id, - label: dmpReference.reference.label, - reference: dmpReference.reference.reference, - source: dmpReference.reference.source, - typeId: null, - description: dmpReference.reference.source, - definition: dmpReference.reference.definition, - abbreviation: dmpReference.reference.abbreviation, - sourceType: dmpReference.reference.sourceType - } - }) - - } - }) + if(dmpReferences){ + dmpReferences.forEach(dmpReference => { + if(dmpReference.data.blueprintFieldId == this.fieldId){ + this.references.push({ + data: dmpReference.data, + reference: { + id: dmpReference.reference.id, + label: dmpReference.reference.label, + reference: dmpReference.reference.reference, + source: dmpReference.reference.source, + typeId: null, + description: dmpReference.reference.source, + definition: dmpReference.reference.definition, + abbreviation: dmpReference.reference.abbreviation, + sourceType: dmpReference.reference.sourceType + } + }) + + } + }) + } return this; } diff --git a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts index 9e4e464c2..3b64d6340 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts +++ b/dmp-frontend/src/app/ui/dmp/listing/dmp-listing.component.ts @@ -18,7 +18,7 @@ import { GuidedTourService } from '@app/library/guided-tour/guided-tour.service' // import { BreadcrumbItem } from '@app/ui/misc/breadcrumb/definition/breadcrumb-item'; import { IsActive } from '@app/core/common/enum/is-active.enum'; import { Description } from '@app/core/model/description/description'; -import { DmpBlueprint } from '@app/core/model/dmp-blueprint/dmp-blueprint'; +import { DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint'; import { Dmp, DmpUser } from '@app/core/model/dmp/dmp'; import { DmpLookup } from '@app/core/query/dmp.lookup'; import { BaseComponent } from '@common/base/base.component'; @@ -172,6 +172,8 @@ export class DmpListingComponent extends BaseComponent implements OnInit { //IBr [nameof(x => x.blueprint), nameof(x => x.id)].join('.'), [nameof(x => x.blueprint), nameof(x => x.label)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.id)].join('.'), + [nameof(x => x.blueprint), nameof(x => x.definition), nameof(x => x.sections), nameof(x => x.label)].join('.'), // [nameof(x => x.descriptionTemplate), nameof(x => x.label)].join('.'), // [nameof(x => x.dmp), nameof(x => x.id)].join('.'), diff --git a/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html b/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html index 5238e0466..af98b8983 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html +++ b/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.html @@ -30,11 +30,11 @@ diff --git a/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.ts b/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.ts index 3feef2fc4..01ca80ff2 100644 --- a/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.ts +++ b/dmp-frontend/src/app/ui/dmp/listing/listing-item/dmp-listing-item.component.ts @@ -91,7 +91,9 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit { autoFocus: false, restoreFocus: false, data: { - dmpId: this.dmp.id + dmpId: this.dmp.id, + dmpName: this.dmp.label, + blueprint: this.dmp.blueprint } }); } @@ -223,4 +225,28 @@ export class DmpListingItemComponent extends BaseComponent implements OnInit { canCreateNewVersion(dmp: Dmp): boolean { return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.CreateNewVersionDmp); } + + canDeleteDmp(dmp: Dmp): boolean { + return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.DeleteDmp); + } + + canCloneDmp(dmp: Dmp): boolean { + return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.CloneDmp); + } + + canFinalizeDmp(dmp: Dmp): boolean { + return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.FinalizeDmp); + } + + canExportDmp(dmp: Dmp): boolean { + return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.ExportDmp); + } + + canInviteDmpUsers(dmp: Dmp): boolean { + return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.InviteDmpUsers); + } + + canAssignDmpUsers(dmp: Dmp): boolean { + return this.isDmpOwner(dmp) || this.authentication.hasPermission(AppPermission.AssignDmpUsers); + } } diff --git a/dmp-frontend/src/app/ui/dmp/new-version-dialog/dmp-new-version-dialog.component.html b/dmp-frontend/src/app/ui/dmp/new-version-dialog/dmp-new-version-dialog.component.html index 385879fe2..42fa65450 100644 --- a/dmp-frontend/src/app/ui/dmp/new-version-dialog/dmp-new-version-dialog.component.html +++ b/dmp-frontend/src/app/ui/dmp/new-version-dialog/dmp-new-version-dialog.component.html @@ -46,7 +46,7 @@
{{'DMP-NEW-VERSION-DIALOG.FIELDS.DESCRIPTIONS-HINT' | translate}}
-
+
@@ -55,7 +55,7 @@
-
+
{{'DMP-NEW-VERSION-DIALOG.NO-DESCRIPTIONS' | translate}}
diff --git a/dmp-frontend/src/app/ui/dmp/new-version-dialog/dmp-new-version-dialog.component.ts b/dmp-frontend/src/app/ui/dmp/new-version-dialog/dmp-new-version-dialog.component.ts index a554437cb..a583898ec 100644 --- a/dmp-frontend/src/app/ui/dmp/new-version-dialog/dmp-new-version-dialog.component.ts +++ b/dmp-frontend/src/app/ui/dmp/new-version-dialog/dmp-new-version-dialog.component.ts @@ -9,6 +9,7 @@ import { TranslateService } from '@ngx-translate/core'; import { takeUntil } from 'rxjs/operators'; import { DmpNewVersionDialogEditorModel } from './dmp-new-version-dialog.editor.model'; import { DmpBlueprintService } from '@app/core/services/dmp/dmp-blueprint.service'; +import { DmpEditorResolver } from '../dmp-editor-blueprint/dmp-editor.resolver'; @Component({ selector: 'app-dmp-new-version-dialog', @@ -39,7 +40,7 @@ export class NewVersionDmpDialogComponent extends BaseComponent { } hasDescriptions() { - return this.dmp.descriptions.length > 0; + return this.dmp.descriptions?.length > 0; } close() { @@ -53,7 +54,7 @@ export class NewVersionDmpDialogComponent extends BaseComponent { confirm() { if (!this.formGroup.valid) { return; } const value: NewVersionDmpPersist = this.formGroup.value; - this.dmpService.newVersion(value).pipe(takeUntil(this._destroyed)).subscribe( + this.dmpService.newVersion(value, DmpEditorResolver.lookupFields()).pipe(takeUntil(this._destroyed)).subscribe( dmp => this.dialogRef.close(dmp), error => this.onCallbackError(error) ); diff --git a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html index 6b08a1e55..3eaf404a6 100644 --- a/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html +++ b/dmp-frontend/src/app/ui/dmp/overview/dmp-overview.component.html @@ -43,14 +43,14 @@
- + - -
@@ -133,7 +133,7 @@
-
+
- -
+ +
@@ -158,7 +158,7 @@

{{ 'DMP-OVERVIEW.ACTIONS.EXPORT' | translate }}

-
+
@@ -190,10 +190,10 @@

{{ enumUtils.toDmpUserRoleString(dmpUser.role) }}

- +
-
+