Fix for calls from the administration (workflow)

This commit is contained in:
nibou230
2022-04-21 12:37:40 -04:00
parent 3de5886ba9
commit 845a552911
2 changed files with 8 additions and 4 deletions

View File

@@ -23,7 +23,6 @@ import org.dspace.core.Context;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.springframework.data.rest.webmvc.ResourceNotFoundException;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Component;
/**
@@ -39,7 +38,6 @@ public class ItemAccessStatusLinkRepository extends AbstractDSpaceRestRepository
@Autowired
AccessStatusService accessStatusService;
@PreAuthorize("hasPermission(#itemId, 'ITEM', 'READ')")
public AccessStatusRest getAccessStatus(@Nullable HttpServletRequest request,
UUID itemId,
@Nullable Pageable optionalPageable,

View File

@@ -3862,6 +3862,8 @@ public class ItemRestRepositoryIT extends AbstractControllerIntegrationTest {
.andExpect(jsonPath("$.inArchive", Matchers.is(false)))
.andExpect(jsonPath("$._links.self.href",
Matchers.containsString("/api/core/items/" + item.getID().toString())))
.andExpect(jsonPath("$._links.accessStatus.href",
Matchers.containsString("/api/core/items/" + item.getID().toString() + "/accessStatus")))
.andExpect(jsonPath("$._links.bundles.href",
Matchers.containsString("/api/core/items/" + item.getID().toString() + "/bundles")))
.andExpect(jsonPath("$._links.mappedCollections.href",
@@ -3885,7 +3887,7 @@ public class ItemRestRepositoryIT extends AbstractControllerIntegrationTest {
getClient(tokenEperson).perform(get("/api/core/items/" + item.getID())
.param("projection", "full"))
.andExpect(status().isOk())
.andExpect(jsonPath("$", HalMatcher.matchNoEmbeds()))
.andExpect(jsonPath("$", HalMatcher.matchEmbeds("accessStatus")))
.andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString())))
.andExpect(jsonPath("$.name", Matchers.is(item.getName())))
.andExpect(jsonPath("$.handle", Matchers.is(item.getHandle())))
@@ -3894,6 +3896,8 @@ public class ItemRestRepositoryIT extends AbstractControllerIntegrationTest {
.andExpect(jsonPath("$.inArchive", Matchers.is(false)))
.andExpect(jsonPath("$._links.self.href",
Matchers.containsString("/api/core/items/" + item.getID().toString())))
.andExpect(jsonPath("$._links.accessStatus.href",
Matchers.containsString("/api/core/items/" + item.getID().toString() + "/accessStatus")))
.andExpect(jsonPath("$._links.bundles.href",
Matchers.containsString("/api/core/items/" + item.getID().toString() + "/bundles")))
.andExpect(jsonPath("$._links.mappedCollections.href",
@@ -3916,7 +3920,7 @@ public class ItemRestRepositoryIT extends AbstractControllerIntegrationTest {
getClient().perform(get("/api/core/items/" + item.getID())
.param("projection", "full"))
.andExpect(status().isOk())
.andExpect(jsonPath("$", HalMatcher.matchNoEmbeds()))
.andExpect(jsonPath("$", HalMatcher.matchEmbeds("accessStatus")))
.andExpect(jsonPath("$.uuid", Matchers.is(item.getID().toString())))
.andExpect(jsonPath("$.name", Matchers.is(item.getName())))
.andExpect(jsonPath("$.handle", Matchers.is(item.getHandle())))
@@ -3927,6 +3931,8 @@ public class ItemRestRepositoryIT extends AbstractControllerIntegrationTest {
Matchers.containsString("/api/core/items/" + item.getID().toString())))
.andExpect(jsonPath("$._links.self.href",
Matchers.containsString("/api/core/items/" + item.getID().toString())))
.andExpect(jsonPath("$._links.accessStatus.href",
Matchers.containsString("/api/core/items/" + item.getID().toString() + "/accessStatus")))
.andExpect(jsonPath("$._links.bundles.href",
Matchers.containsString("/api/core/items/" + item.getID().toString() + "/bundles")))
.andExpect(jsonPath("$._links.mappedCollections.href",