Merge branch 'coar-notify-7' of bitbucket.org:4Science/dspace-cris into coar-notify-7

This commit is contained in:
frabacche
2023-09-21 15:12:19 +02:00
6 changed files with 152 additions and 62 deletions

View File

@@ -0,0 +1,33 @@
package org.dspace.app.rest.authorization.impl;
import org.dspace.app.rest.authorization.AuthorizationFeature;
import org.dspace.app.rest.authorization.AuthorizationFeatureDocumentation;
import org.dspace.app.rest.model.BaseObjectRest;
import org.dspace.app.rest.model.SiteRest;
import org.dspace.core.Context;
import org.dspace.discovery.SearchServiceException;
import org.dspace.services.ConfigurationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.sql.SQLException;
@Component
@AuthorizationFeatureDocumentation(name = CoarNotifyLdnEnabled.NAME,
description = "It can be used to verify if the user can see the coar notify protocol is enabled")
public class CoarNotifyLdnEnabled implements AuthorizationFeature {
public final static String NAME = "coarLdnEnabled";
@Autowired
private ConfigurationService configurationService;
@Override
public boolean isAuthorized(Context context, BaseObjectRest object) throws SQLException, SearchServiceException {
return configurationService.getBooleanProperty("coar-notify.enabled", true);
}
@Override
public String[] getSupportedTypes() {
return new String[]{SiteRest.CATEGORY+"."+SiteRest.NAME};
}
}

View File

@@ -70,7 +70,7 @@ public class NotifyServiceRestRepository extends DSpaceRestRepository<NotifyServ
}
@Override
@PreAuthorize("hasAuthority('AUTHENTICATED')")
@PreAuthorize("hasAuthority('ADMIN')")
protected NotifyServiceRest createAndReturn(Context context) throws AuthorizeException, SQLException {
HttpServletRequest req = getRequestService().getCurrentRequest().getHttpServletRequest();
ObjectMapper mapper = new ObjectMapper();
@@ -92,7 +92,7 @@ public class NotifyServiceRestRepository extends DSpaceRestRepository<NotifyServ
return converter.toRest(notifyServiceEntity, utils.obtainProjection());
}
@Override
@PreAuthorize("hasAuthority('AUTHENTICATED')")
@PreAuthorize("hasAuthority('ADMIN')")
protected void patch(Context context, HttpServletRequest request, String apiCategory, String model, Integer id,
Patch patch) throws AuthorizeException, SQLException {
NotifyServiceEntity notifyServiceEntity = notifyService.find(context, id);
@@ -105,7 +105,7 @@ public class NotifyServiceRestRepository extends DSpaceRestRepository<NotifyServ
}
@Override
@PreAuthorize("hasAuthority('AUTHENTICATED')")
@PreAuthorize("hasAuthority('ADMIN')")
protected void delete(Context context, Integer id) throws AuthorizeException {
try {
NotifyServiceEntity notifyServiceEntity = notifyService.find(context, id);

View File

@@ -133,6 +133,17 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
"service url", "service ldn url")));
}
@Test
public void createForbiddenTest() throws Exception {
ObjectMapper mapper = new ObjectMapper();
NotifyServiceRest notifyServiceRest = new NotifyServiceRest();
String authToken = getAuthToken(eperson.getEmail(), password);
getClient(authToken).perform(post("/api/ldn/ldnservices")
.content(mapper.writeValueAsBytes(notifyServiceRest))
.contentType(contentType))
.andExpect(status().isForbidden());
}
@Test
public void createTest() throws Exception {
ObjectMapper mapper = new ObjectMapper();
@@ -144,7 +155,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
notifyServiceRest.setLdnUrl("service ldn url");
AtomicReference<Integer> idRef = new AtomicReference<Integer>();
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken).perform(post("/api/ldn/ldnservices")
.content(mapper.writeValueAsBytes(notifyServiceRest))
.contentType(contentType))
@@ -162,6 +173,34 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
"service url", "service ldn url")));
}
@Test
public void notifyServicePatchOperationForbiddenTest() throws Exception {
context.turnOffAuthorisationSystem();
NotifyServiceEntity notifyServiceEntity =
NotifyServiceBuilder.createNotifyServiceBuilder(context)
.withName("service name")
.withDescription("service description")
.withUrl("service url")
.withLdnUrl("service ldn url")
.build();
context.restoreAuthSystemState();
List<Operation> ops = new ArrayList<Operation>();
AddOperation operation = new AddOperation("/description", "add service description");
ops.add(operation);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
.contentType(MediaType.APPLICATION_JSON_PATCH_JSON))
.andExpect(status().isForbidden());
}
@Test
public void notifyServiceDescriptionAddOperationBadRequestTest() throws Exception {
@@ -182,7 +221,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -209,7 +248,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -239,7 +278,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -267,7 +306,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -298,7 +337,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -329,7 +368,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -356,7 +395,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -386,7 +425,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -414,7 +453,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -445,7 +484,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -475,7 +514,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -503,7 +542,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -532,7 +571,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -560,7 +599,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -591,7 +630,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -619,7 +658,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -686,8 +725,15 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
}
@Test
public void deleteNotFoundTest() throws Exception {
public void deleteForbiddenTest() throws Exception {
getClient(getAuthToken(eperson.getEmail(), password))
.perform(delete("/api/ldn/ldnservices/" + RandomUtils.nextInt()))
.andExpect(status().isForbidden());
}
@Test
public void deleteNotFoundTest() throws Exception {
getClient(getAuthToken(admin.getEmail(), password))
.perform(delete("/api/ldn/ldnservices/" + RandomUtils.nextInt()))
.andExpect(status().isNotFound());
}
@@ -704,7 +750,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
.build();
context.restoreAuthSystemState();
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(delete("/api/ldn/ldnservices/" + notifyServiceEntity.getID()))
.andExpect(status().isNoContent());
@@ -740,7 +786,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -785,7 +831,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -837,7 +883,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -882,7 +928,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -934,7 +980,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -996,7 +1042,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperation);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1052,7 +1098,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1114,7 +1160,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperation);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1170,7 +1216,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1238,7 +1284,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1296,7 +1342,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1364,7 +1410,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1422,7 +1468,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1485,7 +1531,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperation);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1541,7 +1587,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1609,7 +1655,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1667,7 +1713,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1735,7 +1781,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1793,7 +1839,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1856,7 +1902,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperation);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1912,7 +1958,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -1980,7 +2026,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2038,7 +2084,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2106,7 +2152,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2164,7 +2210,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2232,7 +2278,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2290,7 +2336,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2358,7 +2404,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2416,7 +2462,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2484,7 +2530,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2542,7 +2588,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2611,7 +2657,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2670,7 +2716,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2728,7 +2774,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2797,7 +2843,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2856,7 +2902,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2914,7 +2960,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -2972,7 +3018,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -3030,7 +3076,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(inboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)
@@ -3098,7 +3144,7 @@ public class NotifyServiceRestRepositoryIT extends AbstractControllerIntegration
ops.add(outboundAddOperationTwo);
String patchBody = getPatchContent(ops);
String authToken = getAuthToken(eperson.getEmail(), password);
String authToken = getAuthToken(admin.getEmail(), password);
getClient(authToken)
.perform(patch("/api/ldn/ldnservices/" + notifyServiceEntity.getID())
.content(patchBody)

View File

@@ -1694,3 +1694,4 @@ include = ${module_dir}/usage-statistics.cfg
include = ${module_dir}/versioning.cfg
include = ${module_dir}/workflow.cfg
include = ${module_dir}/external-providers.cfg
include = ${module_dir}/coar-notify-ldn.cfg

View File

@@ -0,0 +1,9 @@
#---------------------------------------------------------------#
#---------------COAR NOTIFY LDN CONFIGURATION-------------------#
#---------------------------------------------------------------#
# Configuration properties used by Coar Notify and ldn #
#---------------------------------------------------------------#
#Boolean to determine if Coar Notify is enabled globally for entire site.
#default => true
coar-notify.enabled = true

View File

@@ -52,6 +52,7 @@ rest.properties.exposed = google.recaptcha.mode
rest.properties.exposed = cc.license.jurisdiction
rest.properties.exposed = identifiers.item-status.register-doi
rest.properties.exposed = authentication-password.domain.valid
rest.properties.exposed = coar-notify.enabled
#---------------------------------------------------------------#
# These configs are used by the deprecated REST (v4-6) module #