Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  UBO-336 FSU040THUL-3698 Escape facet values and search values in NewPublicationWizard (#398)
  UBO-339 Prevent ArrayIndexOutOfBoundException caused in mods-dc.xsl (#400)
  UBO-337 Do not map mods:classification with generator attribute (#399)
  UBO-341 FSU040THUL-3715 Display at least language code when language code cannot be resolved (#401)
  UBO-342-FSU040THUL-3861 Fixed non scrolling facet values (#402)
  UBO-344 Fixed url for genre link badge (#403)
  UBO-345 Do not die on multiple LEAD_ID in IdentityPicker (#405)
  UBO-347 Let ImportListJobAction not use ImportJob.saveAndIndex() (#407)
  UBO-348 large rfc5646 classification makes editor slow (#408)
  • Loading branch information
sebhofmann committed Aug 5, 2024
2 parents b5494a7 + 4347fa2 commit f46fce9
Show file tree
Hide file tree
Showing 15 changed files with 386 additions and 63 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ ubo-cli/target/bin/ubo.sh update permission read for id default with rulefile ub
ubo-cli/target/bin/ubo.sh update permission writedb for id default with rulefile ubo-cli/src/main/setup/acl/acl-rule-administrators-only.xml described by administrators only
ubo-cli/target/bin/ubo.sh update permission deletedb for id default with rulefile ubo-cli/src/main/setup/acl/acl-rule-administrators-only.xml described by administrators only
ubo-cli/target/bin/ubo.sh update permission read for id restapi:/ with rulefile ubo-cli/src/main/setup/acl/acl-rule-always-allowed.xml described by always allowed
ubo-cli/target/bin/ubo.sh update permission read for id restapi:/classifications with rulefile ubo-cli/src/main/setup/acl/acl-rule-always-allowed.xml described by always allowed
```

## MyCoRe-Solr-Configuration
Expand Down
13 changes: 7 additions & 6 deletions docker-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,13 @@ function setUpMyCoRe {
sed -ri "s/<mapping-file>META-INF\/mycore-ifs-mappings.xml<\/mapping-file>//" "${PERSISTENCE_XML}"
/opt/ubo/ubo-cli/target/bin/ubo.sh init superuser
/opt/ubo/ubo-cli/target/bin/ubo.sh update all classifications from directory /opt/ubo/ubo-cli/src/main/setup/classifications
/opt/ubo/ubo-cli/target/bin/ubo.sh update permission update permission create-mods for id POOLPRIVILEGE with rulefile /opt/ubo/ubo-cli/src/main/setup/acl/acl-rule-always-allowed.xml described by always allowed
/opt/ubo/ubo-cli/target/bin/ubo.sh update permission update permission create-users for id POOLPRIVILEGE with rulefile /opt/ubo/ubo-cli/src/main/setup/acl/acl-rule-administrators-only.xml described by administrators only
/opt/ubo/ubo-cli/target/bin/ubo.sh update permission update permission administrate-users for id POOLPRIVILEGE with rulefile /opt/ubo/ubo-cli/src/main/setup/acl/acl-rule-administrators-only.xml described by administrators only
/opt/ubo/ubo-cli/target/bin/ubo.sh update permission update permission read for id default with rulefile /opt/ubo/ubo-cli/src/main/setup/acl/acl-rule-always-allowed.xml described by always allowed
/opt/ubo/ubo-cli/target/bin/ubo.sh update permission update permission writedb for id default with rulefile /opt/ubo/ubo-cli/src/main/setup/acl/acl-rule-administrators-only.xml described by administrators only
/opt/ubo/ubo-cli/target/bin/ubo.sh update permission update permission read for id restapi:/ with rulefile /opt/ubo/ubo-cli/src/main/setup/acl/acl-rule-always-allowed.xml described by always allowed
/opt/ubo/ubo-cli/target/bin/ubo.sh update permission create-mods for id POOLPRIVILEGE with rulefile /opt/ubo/ubo-cli/src/main/setup/acl/acl-rule-always-allowed.xml described by always allowed
/opt/ubo/ubo-cli/target/bin/ubo.sh update permission create-users for id POOLPRIVILEGE with rulefile /opt/ubo/ubo-cli/src/main/setup/acl/acl-rule-administrators-only.xml described by administrators only
/opt/ubo/ubo-cli/target/bin/ubo.sh update permission administrate-users for id POOLPRIVILEGE with rulefile /opt/ubo/ubo-cli/src/main/setup/acl/acl-rule-administrators-only.xml described by administrators only
/opt/ubo/ubo-cli/target/bin/ubo.sh update permission read for id default with rulefile /opt/ubo/ubo-cli/src/main/setup/acl/acl-rule-always-allowed.xml described by always allowed
/opt/ubo/ubo-cli/target/bin/ubo.sh update permission writedb for id default with rulefile /opt/ubo/ubo-cli/src/main/setup/acl/acl-rule-administrators-only.xml described by administrators only
/opt/ubo/ubo-cli/target/bin/ubo.sh update permission read for id restapi:/ with rulefile /opt/ubo/ubo-cli/src/main/setup/acl/acl-rule-always-allowed.xml described by always allowed
/opt/ubo/ubo-cli/target/bin/ubo.sh update permission read for id restapi:/classifications with rulefile /opt/ubo/ubo-cli/src/main/setup/acl/acl-rule-always-allowed.xml described by always allowed
/opt/ubo/ubo-cli/target/bin/ubo.sh update permission deletedb for id default with rulefile /opt/ubo/ubo-cli/src/main/setup/acl/acl-rule-administrators-only.xml described by administrators only
/opt/ubo/ubo-cli/target/bin/ubo.sh reload solr configuration main in core main
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,13 @@ private String buildQuery(Element mods) {
query.append("dedup:").append(MCRSolrUtils.escapeSearchValue(criterion.getKey())).append(" OR ");
}

query.append("(title:\"").append(getByXPath(mods, "mods:titleInfo/mods:title")).append('"');
query.append(" AND person:\"").append(getByXPath(mods, "mods:name/mods:namePart")).append("\"))");
query.append("(title:\"")
.append(MCRSolrUtils.escapeSearchValue(getByXPath(mods, "mods:titleInfo/mods:title")))
.append('"');

query.append(" AND person:\"")
.append(MCRSolrUtils.escapeSearchValue(getByXPath(mods, "mods:name/mods:namePart")))
.append("\"))");

return query.toString();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import org.jdom2.Element;
import org.jdom2.input.SAXBuilder;
import org.mycore.common.MCRMailer;
import org.mycore.common.MCRTransactionHelper;
import org.mycore.common.config.MCRConfiguration2;
import org.mycore.frontend.MCRFrontendUtil;
import org.mycore.services.i18n.MCRTranslation;
Expand Down Expand Up @@ -66,8 +67,15 @@ public void execute() throws ExecutionException {
importJob.enrich();
}

importJob.saveAndIndex();
sendMail(importJob);
try {
MCRTransactionHelper.beginTransaction();
importJob.savePublications();
MCRTransactionHelper.commitTransaction();
sendMail(importJob);
} catch (Exception e) {
LOGGER.error("Error while saving publications", e);
MCRTransactionHelper.rollbackTransaction();
}
} catch (Exception e) {
LOGGER.error("Could not transform form input", e);
}
Expand Down
27 changes: 19 additions & 8 deletions ubo-common/src/main/java/org/mycore/ubo/local/LocalService.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
package org.mycore.ubo.local;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

import javax.naming.OperationNotSupportedException;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jdom2.Element;
import org.mycore.common.config.MCRConfiguration2;
import org.mycore.ubo.picker.IdentityService;
Expand All @@ -17,7 +12,14 @@
import org.mycore.user2.MCRUserAttribute;
import org.mycore.user2.MCRUserManager;

import javax.naming.OperationNotSupportedException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

public class LocalService implements IdentityService {
private final static Logger LOGGER = LogManager.getLogger(LocalService.class);

private final String USER_FIRST_NAME_ATTR = "firstName";

Expand Down Expand Up @@ -51,7 +53,16 @@ public PersonSearchResult searchPerson(String query, MCRRealm realm) {

List<PersonSearchResult.PersonResult> personResults = matchingUsers.stream().map(user -> {
PersonSearchResult.PersonResult personSearchResult = new PersonSearchResult.PersonResult(this);
personSearchResult.pid = user.getUserAttribute("id_" + LEAD_ID);
List<MCRUserAttribute> leadIdAttributes = user.getAttributes()
.stream()
.filter(attr -> ("id_" + LEAD_ID).equals(attr.getName()))
.toList();

if (leadIdAttributes.size() > 1) {
LOGGER.warn("Found more than one {} for user {}", ("id_" + LEAD_ID), user.getUserID());
}

personSearchResult.pid = leadIdAttributes.size() > 0 ? leadIdAttributes.get(0).getValue() : null;
personSearchResult.displayName = user.getRealName().length() > 0 ? user.getRealName() : user.getUserName();

user.getAttributes().stream()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@
<xed:include uri="webapp:import-editor.xed" ref="fix.structure.parent" />
<xed:include uri="webapp:import-editor.xed" ref="cleanup" />
<xed:include uri="webapp:import-editor.xed" ref="cancel.submit" />
<xed:include uri="webapp:import-editor.xed" ref="javascript" />
</xed:template>
</xed:form>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@

<xed:include uri="webapp:import-editor.xed" ref="cleanup" />
<xed:include uri="webapp:import-editor.xed" ref="cancel.submit" />

<xed:include uri="webapp:import-editor.xed" ref="javascript" />
</xed:bind>

</xed:form>
Expand Down
37 changes: 16 additions & 21 deletions ubo-common/src/main/resources/META-INF/resources/import-editor.xed
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@
]]>
</script>
</xed:template>

<xed:template id="javascript">
<script type="text/javascript" src="{$WebApplicationBaseURL}js/language-search.js"></script>
</xed:template>

<xed:template id="displayValidationMessages">
<xed:if test="$xed-validation-failed">
Expand Down Expand Up @@ -264,13 +268,10 @@
</xed:bind>
<span class="mx-2 align-self-center"> in </span>
<xed:bind xpath="@xml:lang">
<select class="mycore-form-input-double custom-select">
<option value=""><xed:output i18n="search.select" /></option>
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:de" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:en" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:fr" />
<xed:include uri="xslStyle:items2options:classification:editor:-1:children:rfc5646" />
</select>
<div class="language-search d-inline" data-preferred-languages="de,en,fr">
<input id="{xed:generate-id(..)}" type="hidden" class="language-search-input"/>
<!-- content is added by javascript -->
</div>
</xed:bind>
</div>
<xed:controls />
Expand Down Expand Up @@ -781,13 +782,10 @@
<xed:output value="concat(i18n:translate('ubo.language'), ': ')" />
</label>
<xed:bind xpath="mods:languageTerm[@type='code'][@authority='rfc5646']">
<select id="{xed:generate-id(..)}" class="autocomplete mycore-form-input custom-select">
<option value=""><xed:output i18n="search.select" /></option>
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:de" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:en" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:fr" />
<xed:include uri="xslStyle:items2options:classification:editor:-1:children:rfc5646" />
</select>
<div class="language-search" data-preferred-languages="de,en,fr">
<input id="{xed:generate-id()}" type="hidden" class="language-search-input"/>
<!-- content is added by javascript -->
</div>
</xed:bind>
<xed:controls />
</div>
Expand All @@ -801,13 +799,10 @@
<label for="{xed:generate-id()}" class="mycore-form-label">
<xed:output value="concat(i18n:translate('ubo.abstract.in'), ': ')" />
</label>
<select class="mycore-form-input custom-select">
<option value=""><xed:output i18n="search.select" /></option>
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:de" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:en" />
<xed:include uri="xslStyle:items2options:classification:editor:0:parents:rfc5646:fr" />
<xed:include uri="xslStyle:items2options:classification:editor:-1:children:rfc5646" />
</select>
<div class="language-search" data-preferred-languages="de,en,fr">
<input id="{xed:generate-id()}" type="hidden" class="language-search-input"/>
<!-- content is added by javascript -->
</div>
</xed:bind>
<xed:controls />
</div>
Expand Down
Loading

0 comments on commit f46fce9

Please sign in to comment.