Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 6ea17905 authored by Joze RIHTARSIC's avatar Joze RIHTARSIC
Browse files

[EDELIVERY-14195] resource visibility changed

parent 121baf69
No related tags found
No related merge requests found
Pipeline #222044 failed
......@@ -54,6 +54,7 @@
<mat-label>{{ "resource.details.panel.label.resource.visibility" | translate }}</mat-label>
<select matNativeControl formControlName="visibility"
matTooltip="{{ 'resource.details.panel.tooltip.resource.visibility' | translate }}"
(change)="onVisibilityChanged($event)"
id="visibility_id" required>
<option *ngFor="let visibility of groupVisibilityOptions"
[value]="visibility.value">
......
......@@ -177,6 +177,24 @@ export class ResourceDetailsPanelComponent implements BeforeLeaveGuard {
this.resourceForm.reset(this._resource);
}
async onVisibilityChanged(event: any) {
let showWarning: boolean = this._resource?.visibility === VisibilityEnum.Public && event.target.value === VisibilityEnum.Private;
if (showWarning) {
this.dialog.open(ConfirmationDialogComponent, {
data: {
title: await lastValueFrom(this.translateService.get("resource.details.panel.visibility.change.confirmation.dialog.title")),
description: await lastValueFrom(this.translateService.get("resource.details.panel.visibility.change.confirmation.dialog.description"))
}
}).afterClosed().subscribe(result => {
if (!result) {
// prevent default does not work in case of "async"
this.resourceForm.controls['visibility'].setValue(VisibilityEnum.Public);
this.resourceForm.controls['visibility'].markAsPristine();
}
});
}
}
async onReviewEnabledChanged(event: any) {
let newReviewEnabled: boolean = event.target.checked;
let showWarning: boolean = this._resource?.reviewEnabled && !newReviewEnabled;
......
......@@ -379,6 +379,9 @@
"resource.details.panel.button.save": "Save",
"resource.details.panel.review.disabled.confirmation.dialog.title": "Review disabled?",
"resource.details.panel.review.disabled.confirmation.dialog.description": "All document versions with review statuses (UNDER_REVIEW, APPROVED, REJECTED) will be set to DRAFT\nDo you want to continue?",
"resource.details.panel.visibility.change.confirmation.dialog.title": "Visibility change?",
"resource.details.panel.visibility.change.confirmation.dialog.description": "If the resource includes shared documents for a resource or subresource, existing users can continue to access the documents as reference, but it can not be added as a reference the new documents.\nDo you want to continue?",
"document.edit.panel.button.back": "Back",
"document.edit.panel.button.cancel": "Cancel",
......
......@@ -45,6 +45,7 @@ public class DBSubresourceToSubresourceROConverter implements Converter<DBSubres
BeanUtils.copyProperties(target, source);
target.setSubresourceTypeIdentifier(source.getSubresourceDef().getIdentifier());
target.setSubresourceId(SessionSecurityUtils.encryptedEntityId(source.getId()));
} catch (IllegalAccessException | InvocationTargetException e) {
LOG.error("Error occurred while converting DBResource", e);
return null;
......
......@@ -24,6 +24,7 @@ public class SubresourceRO extends BaseRO {
String identifierValue;
String identifierScheme;
String subresourceTypeIdentifier;
Boolean isDocumentSharingEnabled = false;
public String getSubresourceId() {
......@@ -57,4 +58,12 @@ public class SubresourceRO extends BaseRO {
public void setSubresourceTypeIdentifier(String subresourceTypeIdentifier) {
this.subresourceTypeIdentifier = subresourceTypeIdentifier;
}
public Boolean getDocumentSharingEnabled() {
return isDocumentSharingEnabled;
}
public void setDocumentSharingEnabled(Boolean documentSharingEnabled) {
isDocumentSharingEnabled = documentSharingEnabled;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment