Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.dspace.authorize.service.AuthorizeService;
import org.dspace.content.Item;
import org.dspace.core.Context;
import org.dspace.eperson.EPerson;
import org.dspace.services.ConfigurationService;
import org.springframework.beans.factory.annotation.Autowired;

Expand Down Expand Up @@ -117,10 +118,12 @@ public boolean isHidden(Context context, String schema, String element, String q
}

// The user is not administrator, but he could be a submitter
if (hidden && Objects.nonNull(context) && Objects.nonNull(item) &&
this.submitterShouldSee(schema, element, qualifier)) {
// the submitters override
hidden = !item.getSubmitter().equals(context.getCurrentUser());
if (hidden && Objects.nonNull(context) && Objects.nonNull(item)) {
EPerson submitter = item.getSubmitter();
if (Objects.nonNull(submitter) && this.submitterShouldSee(schema, element, qualifier)) {
// the submitters override
hidden = !submitter.equals(context.getCurrentUser());
}
}

return hidden;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5102,6 +5102,19 @@ public void submitterShouldSeeLocalNoteMetadata() throws Exception {
.andExpect(jsonPath("$", HalMatcher.matchNoEmbeds()))
.andExpect(jsonPath("$", existNoteLocalMetadataMatcher))
.andExpect(jsonPath("$", existDescriptionProvenanceMetadataMatcher));

// After the submitter is deleted, the response for the request made using the previously issued submitter
// token (which now authenticates as anonymous) should not contain
// `local.submission.note` and `dc.description.provenance` metadata
context.turnOffAuthorisationSystem();
EPersonBuilder.deleteEPerson(submitter.getID());
context.restoreAuthSystemState();

getClient(submitterToken).perform(get("/api/core/items/" + publicItem.getID()))
.andExpect(status().isOk())
.andExpect(jsonPath("$", HalMatcher.matchNoEmbeds()))
.andExpect(jsonPath("$", notExistNoteLocalMetadataMatcher))
.andExpect(jsonPath("$", notExistDescriptionProvenanceMetadataMatcher));
}

/**
Expand Down
Loading