|
1 | 1 | /*
|
2 |
| - * Copyright (C) 2001-2023 Food and Agriculture Organization of the |
| 2 | + * Copyright (C) 2001-2024 Food and Agriculture Organization of the |
3 | 3 | * United Nations (FAO-UN), United Nations World Food Programme (WFP)
|
4 | 4 | * and United Nations Environment Programme (UNEP)
|
5 | 5 | *
|
|
60 | 60 | import org.fao.geonet.kernel.setting.Settings;
|
61 | 61 | import org.fao.geonet.repository.*;
|
62 | 62 | import org.fao.geonet.util.MetadataPublicationMailNotifier;
|
63 |
| -import org.fao.geonet.util.UserUtil; |
64 | 63 | import org.fao.geonet.utils.Log;
|
65 | 64 | import org.fao.geonet.utils.Xml;
|
66 | 65 | import org.jdom.Element;
|
@@ -224,12 +223,13 @@ public MetadataWorkflowStatusResponse getStatus(
|
224 | 223 | HttpServletRequest request) throws Exception {
|
225 | 224 | AbstractMetadata metadata = ApiUtils.canEditRecord(metadataUuid, request);
|
226 | 225 | Locale locale = languageUtils.parseAcceptLanguage(request.getLocales());
|
| 226 | + ResourceBundle messages = ApiUtils.getMessagesResourceBundle(request.getLocales()); |
227 | 227 | ServiceContext context = ApiUtils.createServiceContext(request, locale.getISO3Language());
|
228 | 228 |
|
229 | 229 | // --- only allow the owner of the record to set its status
|
230 | 230 | if (!accessManager.isOwner(context, String.valueOf(metadata.getId()))) {
|
231 | 231 | throw new SecurityException(
|
232 |
| - "Only the owner of the metadata can get the status. User is not the owner of the metadata"); |
| 232 | + messages.getString("api.metadata.status.errorGetStatusNotAllowed")); |
233 | 233 | }
|
234 | 234 |
|
235 | 235 | MetadataStatus recordStatus = metadataStatus.getStatus(metadata.getId());
|
@@ -476,7 +476,7 @@ public Map<Integer, StatusChangeType> setStatus(@Parameter(description = API_PAR
|
476 | 476 | // --- only allow the owner of the record to set its status
|
477 | 477 | if (!accessManager.isOwner(context, String.valueOf(metadata.getId()))) {
|
478 | 478 | throw new SecurityException(
|
479 |
| - "Only the owner of the metadata can set the status of this record. User is not the owner of the metadata."); |
| 479 | + messages.getString("api.metadata.status.errorSetStatusNotAllowed")); |
480 | 480 | }
|
481 | 481 |
|
482 | 482 | boolean isAllowedSubmitApproveInvalidMd = settingManager
|
@@ -526,13 +526,13 @@ public Map<Integer, StatusChangeType> setStatus(@Parameter(description = API_PAR
|
526 | 526 |
|
527 | 527 | if ((status.getStatus() == Integer.parseInt(StatusValue.Status.APPROVED) && notifyByEmail)
|
528 | 528 | && (this.metadataUtils.isMetadataPublished(metadataIdApproved))) {
|
529 |
| - MetadataPublicationNotificationInfo metadataNotificationInfo = new MetadataPublicationNotificationInfo(); |
530 |
| - metadataNotificationInfo.setMetadataUuid(metadata.getUuid()); |
531 |
| - metadataNotificationInfo.setMetadataId(metadataIdApproved); |
532 |
| - metadataNotificationInfo.setGroupId(metadata.getSourceInfo().getGroupOwner()); |
533 |
| - metadataNotificationInfo.setPublished(true); |
534 |
| - metadataNotificationInfo.setPublicationDateStamp(new ISODate()); |
535 |
| - metadataNotificationInfo.setReapproval(metadataIdApproved != metadata.getId()); |
| 529 | + MetadataPublicationNotificationInfo metadataNotificationInfo = new MetadataPublicationNotificationInfo(); |
| 530 | + metadataNotificationInfo.setMetadataUuid(metadata.getUuid()); |
| 531 | + metadataNotificationInfo.setMetadataId(metadataIdApproved); |
| 532 | + metadataNotificationInfo.setGroupId(metadata.getSourceInfo().getGroupOwner()); |
| 533 | + metadataNotificationInfo.setPublished(true); |
| 534 | + metadataNotificationInfo.setPublicationDateStamp(new ISODate()); |
| 535 | + metadataNotificationInfo.setReapproval(metadataIdApproved != metadata.getId()); |
536 | 536 |
|
537 | 537 |
|
538 | 538 | // If the metadata workflow is enabled retrieve the submitter and reviewer users information
|
|
0 commit comments