4Science / DSpace

This repository contains the 4Science optimized DSpace & DSpace-CRIS distribution.
https://wiki.lyrasis.org/display/DSPACECRIS/
BSD 3-Clause "New" or "Revised" License
43 stars 62 forks source link

inconsistent profile owner checks for metadata language #325

Closed floriangantner closed 1 year ago

floriangantner commented 1 year ago

Describe the bug Some functionality cannot be triggered when the cris profile owner's metadata field has some metadata language.

To Reproduce Steps to reproduce the behavior:

  1. Create some profile with some owner which metadatavalue has some language tag. This can be the case if you have some default.language=<your-preferred-locale> property configured and you import the cris entities following the normal cris migration procedure where the language is then considered for new imported metadadata. https://github.com/4Science/DSpace/blob/822f5828bd4f415ada8b3cf965b57187456bd46f/dspace-api/src/main/java/org/dspace/app/batch/ItemImportOA.java#L696 https://github.com/4Science/DSpace/blob/822f5828bd4f415ada8b3cf965b57187456bd46f/dspace-api/src/main/java/org/dspace/app/batch/ItemImportOA.java#L697
  2. Then create some setting where this profile is meant to be used in some shared workspace https://github.com/4Science/DSpace/blob/822f5828bd4f415ada8b3cf965b57187456bd46f/dspace-api/src/main/java/org/dspace/discovery/SharedWorkspaceSolrIndexPlugin.java#L125 or this profile is connected with some orcid is is trying to push some entry to orcid (https://github.com/4Science/DSpace/blob/822f5828bd4f415ada8b3cf965b57187456bd46f/dspace-server-webapp/src/main/java/org/dspace/app/rest/security/OrcidHistorySendToOrcidRestPermissionEvaluatorPlugin.java#L92). In both cases there is some check for language null, so no language at all and for the mentioned setting this will not work and the functionality will not be offered/available.
  3. The owner check in other classes, like the ResearcherProfileService https://github.com/4Science/DSpace/blob/822f5828bd4f415ada8b3cf965b57187456bd46f/dspace-api/src/main/java/org/dspace/profile/ResearcherProfileServiceImpl.java#L211 uses the Item.ANY language and thus checks metadatavalue with all language values and also not existing language values.

Expected behavior From our point of view we expect the owner's metadata language to have no impact on the offered functionality. We suggest to replace all null to Item.ANY in the both above mentioned and linked occurences in the code.

Related work Update: changed lines for better preview