mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-13 13:03:11 +00:00
Revert "[CST-5669] Set orcid access token as hardcoded hidden metadata fields"
This reverts commit 4afa62a4c0
.
This commit is contained in:
@@ -60,12 +60,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
public class MetadataExposureServiceImpl implements MetadataExposureService {
|
public class MetadataExposureServiceImpl implements MetadataExposureService {
|
||||||
protected Logger log = org.apache.logging.log4j.LogManager.getLogger(MetadataExposureServiceImpl.class);
|
protected Logger log = org.apache.logging.log4j.LogManager.getLogger(MetadataExposureServiceImpl.class);
|
||||||
|
|
||||||
private final static Set<String> HARDCODED_HIDDEN_ELEMENTS = Set.of(
|
|
||||||
"dspace.orcid.access-token",
|
|
||||||
"dspace.orcid.refresh-token",
|
|
||||||
"eperson.orcid.access-token",
|
|
||||||
"eperson.orcid.refresh-token");
|
|
||||||
|
|
||||||
protected Map<String, Set<String>> hiddenElementSets = null;
|
protected Map<String, Set<String>> hiddenElementSets = null;
|
||||||
protected Map<String, Map<String, Set<String>>> hiddenElementMaps = null;
|
protected Map<String, Map<String, Set<String>>> hiddenElementMaps = null;
|
||||||
|
|
||||||
@@ -138,17 +132,6 @@ public class MetadataExposureServiceImpl implements MetadataExposureService {
|
|||||||
if (key.startsWith(CONFIG_PREFIX)) {
|
if (key.startsWith(CONFIG_PREFIX)) {
|
||||||
if (configurationService.getBooleanProperty(key, true)) {
|
if (configurationService.getBooleanProperty(key, true)) {
|
||||||
String mdField = key.substring(CONFIG_PREFIX.length());
|
String mdField = key.substring(CONFIG_PREFIX.length());
|
||||||
addHiddenElement(key, mdField);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
HARDCODED_HIDDEN_ELEMENTS.forEach(element -> addHiddenElement(element, element));
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void addHiddenElement(String key, String mdField) {
|
|
||||||
String segment[] = mdField.split("\\.", 3);
|
String segment[] = mdField.split("\\.", 3);
|
||||||
|
|
||||||
// got schema.element.qualifier
|
// got schema.element.qualifier
|
||||||
@@ -172,4 +155,8 @@ public class MetadataExposureServiceImpl implements MetadataExposureService {
|
|||||||
"config property=" + key);
|
"config property=" + key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -158,14 +158,6 @@ public class ItemBuilder extends AbstractDSpaceObjectBuilder<Item> {
|
|||||||
return addMetadataValue(item, "dspace", "object", "owner", null, value, authority, CF_ACCEPTED);
|
return addMetadataValue(item, "dspace", "object", "owner", null, value, authority, CF_ACCEPTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ItemBuilder withOrcidAccessToken(String accessToken) {
|
|
||||||
return addMetadataValue(item, "dspace", "orcid", "access-token", accessToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemBuilder withOrcidRefreshToken(String refreshToken) {
|
|
||||||
return addMetadataValue(item, "dspace", "orcid", "refresh-token", refreshToken);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ItemBuilder makeUnDiscoverable() {
|
public ItemBuilder makeUnDiscoverable() {
|
||||||
item.setDiscoverable(false);
|
item.setDiscoverable(false);
|
||||||
return this;
|
return this;
|
||||||
|
@@ -3129,27 +3129,4 @@ public class EPersonRestRepositoryIT extends AbstractControllerIntegrationTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void hiddenOrcidMetadataFieldsTest() throws Exception {
|
|
||||||
|
|
||||||
context.turnOffAuthorisationSystem();
|
|
||||||
|
|
||||||
EPerson ePerson = EPersonBuilder.createEPerson(context)
|
|
||||||
.withEmail("test@user.it")
|
|
||||||
.withPassword(password)
|
|
||||||
.withNameInMetadata("Test", "User")
|
|
||||||
.withOrcidAccessToken("23bc2f69-b7c7-4e55-9dc4-d4e09382f687")
|
|
||||||
.withOrcidRefreshToken("a6c6dbdc-41b3-4e86-8aaf-2ac50253dc74")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
context.restoreAuthSystemState();
|
|
||||||
|
|
||||||
String authToken = getAuthToken(ePerson.getEmail(), password);
|
|
||||||
getClient(authToken).perform(get("/api/eperson/epersons/{uuid}", ePerson.getID()))
|
|
||||||
.andExpect(status().isOk())
|
|
||||||
.andExpect(jsonPath("$.metadata.['eperson.orcid.access-token']").doesNotExist())
|
|
||||||
.andExpect(jsonPath("$.metadata.['eperson.orcid.refresh-token']").doesNotExist());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -4414,32 +4414,4 @@ public class ItemRestRepositoryIT extends AbstractControllerIntegrationTest {
|
|||||||
.andExpect(jsonPath("$.status", notNullValue()));
|
.andExpect(jsonPath("$.status", notNullValue()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void hiddenOrcidMetadataFieldsTest() throws Exception {
|
|
||||||
|
|
||||||
context.turnOffAuthorisationSystem();
|
|
||||||
|
|
||||||
parentCommunity = CommunityBuilder.createCommunity(context)
|
|
||||||
.withName("Parent Community")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
Collection owningCollection = CollectionBuilder.createCollection(context, parentCommunity)
|
|
||||||
.withName("Owning Collection")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
Item item = ItemBuilder.createItem(context, owningCollection)
|
|
||||||
.withTitle("Test item")
|
|
||||||
.withOrcidAccessToken("23bc2f69-b7c7-4e55-9dc4-d4e09382f687")
|
|
||||||
.withOrcidRefreshToken("a6c6dbdc-41b3-4e86-8aaf-2ac50253dc74")
|
|
||||||
.build();
|
|
||||||
|
|
||||||
context.restoreAuthSystemState();
|
|
||||||
|
|
||||||
getClient().perform(get("/api/core/items/{uuid}", item.getID()))
|
|
||||||
.andExpect(status().isOk())
|
|
||||||
.andExpect(jsonPath("$.metadata.['dspace.orcid.access-token']").doesNotExist())
|
|
||||||
.andExpect(jsonPath("$.metadata.['dspace.orcid.refresh-token']").doesNotExist());
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -928,6 +928,10 @@ webui.licence_bundle.show = false
|
|||||||
# since that usually contains email addresses which ought to be kept
|
# since that usually contains email addresses which ought to be kept
|
||||||
# private and is mainly of interest to administrators:
|
# private and is mainly of interest to administrators:
|
||||||
metadata.hide.dc.description.provenance = true
|
metadata.hide.dc.description.provenance = true
|
||||||
|
metadata.hide.dspace.orcid.access-token = true
|
||||||
|
metadata.hide.dspace.orcid.refresh-token = true
|
||||||
|
metadata.hide.eperson.orcid.access-token = true
|
||||||
|
metadata.hide.eperson.orcid.refresh-token = true
|
||||||
|
|
||||||
##### Settings for Submission Process #####
|
##### Settings for Submission Process #####
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user