Skip to content

Commit

Permalink
Timemaps should use the ACL of the original resource (#1991)
Browse files Browse the repository at this point in the history
  • Loading branch information
whikloj committed May 19, 2022
1 parent 4d0a05b commit 879f528
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,9 @@ protected void addExternalContentHeaders(final FedoraResource resource) {

private void addAclHeader(final FedoraResource resource) {
if (!(resource instanceof WebacAcl) && !resource.isMemento()) {
final String resourceUri = getUri(resource.getDescribedResource()).toString();
final FedoraResource resourceForAcl = resource instanceof TimeMap ? resource.getOriginalResource() :
resource.getDescribedResource();
final String resourceUri = getUri(resourceForAcl).toString();
final String aclLocation = resourceUri + (resourceUri.endsWith("/") ? "" : "/") + FCR_ACL;
servletResponse.addHeader(LINK, buildLink(aclLocation, "acl"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -842,15 +842,14 @@ private static void verifyMementoUri(final String message, final String expected
* @param uri the URI of the resource.
*/
private static void verifyTimeMapHeaders(final CloseableHttpResponse response, final String uri) {
final String ldpcvUri = uri + "/" + FCR_VERSIONS;
checkForLinkHeader(response, RESOURCE.toString(), "type");
checkForLinkHeader(response, CONTAINER.toString(), "type");
checkForLinkHeader(response, RDF_SOURCE.getURI(), "type");
checkForLinkHeader(response, uri, "original");
checkForLinkHeader(response, uri, "timegate");
checkForLinkHeader(response, uri + "/" + FCR_VERSIONS, "timemap");
checkForLinkHeader(response, VERSIONING_TIMEMAP_TYPE, "type");
checkForLinkHeader(response, ldpcvUri + "/" + FCR_ACL, "acl");
checkForLinkHeader(response, uri + "/" + FCR_ACL, "acl");
assertFalse(response.getFirstHeader("Allow").getValue().contains("DELETE"));
assertTrue(response.getFirstHeader("Allow").getValue().contains("GET"));
assertTrue(response.getFirstHeader("Allow").getValue().contains("HEAD"));
Expand Down

0 comments on commit 879f528

Please sign in to comment.