Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FCREPO-1627 (https://jira.duraspace.org/browse/FCREPO-1627) #841

Closed
wants to merge 63 commits into from
Closed

FCREPO-1627 (https://jira.duraspace.org/browse/FCREPO-1627) #841

wants to merge 63 commits into from

Conversation

jrgriffiniii
Copy link

Raising a ClientErrorException with a 403 status code for attempts to create graphs using PUT requests for resources under pairtree Nodes within FedoraLdp#createOrReplaceObjectRdf; Implementing FedoraLdpIT#testPutOnPairtree for the case in which clients attempt to PUT graphs under pairtree Nodes

@@ -271,6 +271,8 @@ public Response createOrReplaceObjectRdf(

if (httpConfiguration.putRequiresIfMatch() && StringUtils.isBlank(ifMatch) && !resource.isNew()) {
throw new ClientErrorException("An If-Match header is required", 428);
} else if (resource.hasType(FEDORA_PAIRTREE)) {
throw new ClientErrorException("Graphs cannot be created for resources under pairtree nodes", FORBIDDEN);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want something more semantically specific here?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ajs6f, are you suggesting a new, more specific exception type?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ye, something like CannotModifySystemResourceException except with a snappier title.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would please propose the following in response to this:

  • ForbiddenResourceModificationException
  • UnsupportedResourceModificationException
  • IllegalResourceModification
  • BadResourceModification

My preference lies primarily with the term "Forbidden" (the mapping to the HTTP 403 response description feels appropriate), but I could certainly defend "Unsupported" as well.

"Illegal" and "Bad" concern me given that they may easily be applicable within situations in which, I would speculate, a 405 response is appropriate. "Cannot" also concerns me in this regard (as well as it being identified as undesirable).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ForbiddenResourceModificationException is fine with me.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@awoods
Copy link

awoods commented Jul 27, 2015

This looks good to me. @ajs6f, let me know if your review is done, then I will squash and merge tonight.

@@ -271,6 +273,9 @@ public Response createOrReplaceObjectRdf(

if (httpConfiguration.putRequiresIfMatch() && StringUtils.isBlank(ifMatch) && !resource.isNew()) {
throw new ClientErrorException("An If-Match header is required", 428);
} else if (resource.hasType(FEDORA_PAIRTREE)) {
throw new ForbiddenResourceModificationException("Graphs cannot be created for resources " +
"under pairtree nodes");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little confused here, but shouldn't this read "Graphs cannot be created for resources that are pairtree nodes" and wouldn't it be better to have one string on one line?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally, I would prefer wording along the lines of, '"Resources cannot be created under pairtree elements."'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not worried about the word "graph" and if you like it better without it, fine by me. I'm confused about whether at this moment in the workflow the client is trying to create anything under resource or is trying to create resource or what. I just want to make sure a) that this test is coming at the right time in the workflow and b) that it is throwing out an exception with the right message.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

POST without a slug creates a resource as a child of the POST target container.
e.g. POST /rest/test
results in:
/rest/test/new-resource

PUT creates a resource as the PUT target itself.
e.g. PUT /rest/test
results in:
/rest/test

Note: The wording of the exception here should probably be in line with the one provided when trying to PUT over an existing pairtree element. See: https://jira.duraspace.org/browse/FCREPO-1505

...although I prefer the wording discussed here versus that found in FCREPO-1505.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, cool then. How about "Resources cannot be manually created under pairtree elements!"

escowles and others added 24 commits August 29, 2015 10:13
add created = fedora:created :: xsd:dateTime;
lastModified = fedora:lastModified :: xsd:dateTime;
hasParent = fedora:hasParent :: xsd:string;

Resolves: https://jira.duraspace.org/browse/FCREPO-1552
- Response to code review comments
* Add unit tests for FedoraTypesUtils::isExternalNode
* Make GetCacheManager class package-protected
* Remove GetBinaryStore class, as it can be inlined in GetClusterConfiguration class

Related to: https://jira.duraspace.org/browse/FCREPO-1535
… code for attempts to create graphs using PUT requests for resources under pairtree Nodes within FedoraLdp#createOrReplaceObjectRdf; Implementing FedoraLdpIT#testPutOnPairtree for the case in which clients attempt to PUT graphs under pairtree Nodes
- Use ebucore:filename for premis:hasOriginalName
- Use ebucore:hasMimeType for jcr/fedora:mimeType

Resolves: https://jira.duraspace.org/browse/FCREPO-1532
- Add minor exclusion for jacoco analysis

Resolves: https://jira.duraspace.org/browse/FCREPO-1643
rename org.fcrepo.kernel.impl package to org.fcrepo.kernel.modeshape
yinlinchen and others added 27 commits August 29, 2015 10:13
…tion message within FedoraLdp#createOrReplaceObjectRdf; Ensuring that attempts to create Objects under pairtree nodes within FedoraLdp#createObject raises an instance of ForbiddenResourceModificationException
…onse.Status.FORBIDDEN in compliance with checkstyle
Move exception handling from FedoraLdp into ContentExposingResource
Correcting problematic hasVersions triple

Rebase-age
…OnPairtree verifies that transmitting a PUT request for "[pairtree]/test" raises the 403 status code
@jrgriffiniii
Copy link
Author

After failed attempts to rebase the fcrepo-1627 branch, this pull request is deprecated by #901.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants