Skip to content

Commit f799371

Browse files
Merge remote-tracking branch 'origin/maven/fixes/9.0' into maven/release/9.0
2 parents 66ea8fb + 49271a9 commit f799371

File tree

6 files changed

+29
-7
lines changed

6 files changed

+29
-7
lines changed

Backend/alfresco/module/src/main/java/org/edu_sharing/metadataset/v2/MetadataReader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,7 @@ private List<MetadataKey> getValues(NodeList keysNode, String valuespaceI18n, St
744744
? key.getKey()
745745
: cap,
746746
fallback));
747-
key.setDescription(getTranslation(key, description));
747+
key.setDescription(getTranslation(key, description, ""));
748748
keys.add(key);
749749
}
750750
return keys;

Backend/services/core/src/main/java/org/edu_sharing/metadataset/v2/tools/MetadataTemplateRenderer.java

+19-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import org.apache.commons.lang3.StringEscapeUtils;
1212
import org.apache.commons.lang3.StringUtils;
1313
import org.apache.log4j.Logger;
14-
import org.edu_sharing.alfresco.policy.GuestCagePolicy;
1514
import org.edu_sharing.alfresco.repository.server.authentication.Context;
1615
import org.edu_sharing.metadataset.v2.*;
1716
import org.edu_sharing.repository.client.tools.CCConstants;
@@ -36,6 +35,8 @@
3635
import java.text.SimpleDateFormat;
3736
import java.time.Duration;
3837
import java.util.*;
38+
import java.util.regex.Matcher;
39+
import java.util.regex.Pattern;
3940
import java.util.stream.Collectors;
4041

4142

@@ -150,6 +151,7 @@ private String renderTemplate(MetadataTemplate template) throws IllegalArgumentE
150151
html += "<div class='mdsGroup mdsGroup-" + template.getId() + "'>" + "<h2 class='mdsCaption " + template.getId() + "'>" + template.getCaption() + "</h2>" + "<div class='mdsContent'>";
151152
}
152153
String content=template.getHtml();
154+
content = replaceI18nStrings(content);
153155
for(MetadataWidget srcWidget : mds.getWidgets()){
154156
MetadataWidget widget=mds.findWidgetForTemplateAndCondition(srcWidget.getId(),template.getId(),properties);
155157
int start=content.indexOf("<"+srcWidget.getId());
@@ -433,6 +435,22 @@ private String renderTemplate(MetadataTemplate template) throws IllegalArgumentE
433435
return html;
434436
}
435437

438+
private static String replaceI18nStrings(String content) {
439+
Pattern pattern = Pattern.compile("<i18n ([^>]+)>");
440+
Matcher matcher = pattern.matcher(content);
441+
content = matcher.replaceAll(matchResult -> {
442+
if(matchResult.groupCount() == 1) {
443+
try {
444+
return MetadataHelper.getTranslation(matchResult.group(1));
445+
} catch (Exception e) {
446+
return matchResult.group(1);
447+
}
448+
}
449+
return "";
450+
});
451+
return content;
452+
}
453+
436454
private boolean renderMaterialFeedback(MetadataWidget widget, StringBuffer widgetHtml) {
437455
boolean empty=true;
438456
try {

Backend/services/core/src/main/java/org/edu_sharing/service/search/SearchServiceElastic.java

+1
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ public BoolQuery.Builder getReadPermissionsQuery(BoolQuery.Builder builder) {
219219
// @TODO: FIX after DESP-840
220220
BoolQuery collectionPermissions = getPermissionsQuery(QueryBuilders.bool(), "collections.permissions.read")
221221
.should(s -> s.match(m -> m.field("collections.owner").query(user)))
222+
.must(must -> must.match(match -> match.field("collections.relation.type").query("ccm:usage")))
222223
.build();
223224

224225
BoolQuery proposalPermissions = getPermissionsQuery(QueryBuilders.bool(), "collections.permissions.Coordinator", getUserAuthorities().stream().filter(a -> !a.equals(CCConstants.AUTHORITY_GROUP_EVERYONE)).collect(Collectors.toSet()))

Backend/services/core/src/main/java/org/edu_sharing/spring/security/saml2/SecurityConfigurationSamlRelyingParties.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,8 @@
2727
import java.security.cert.CertificateFactory;
2828
import java.security.cert.X509Certificate;
2929
import java.security.interfaces.RSAPrivateKey;
30-
import java.util.Collection;
31-
import java.util.List;
32-
import java.util.UUID;
30+
import java.util.*;
31+
import java.util.concurrent.atomic.AtomicInteger;
3332
import java.util.stream.Collectors;
3433

3534
@Profile("samlEnabled")
@@ -64,9 +63,13 @@ RelyingPartyRegistrationRepository relyingPartyRegistrationRepository() {
6463
throw new RuntimeException("no IDP metadata configured");
6564
}
6665

66+
Map<String, AtomicInteger> rpIds = new HashMap<>();
67+
6768
List<RelyingPartyRegistration> relyingPartyRegistration = b
6869
.stream().map((builder) -> {
6970
String relyingPartyId = getRelyingPartyId(builder);
71+
int count = rpIds.computeIfAbsent(relyingPartyId, k -> new AtomicInteger(0)).incrementAndGet();
72+
relyingPartyId = (count > 1) ? relyingPartyId + "-" + count : relyingPartyId;
7073
return builder.registrationId(relyingPartyId)
7174
.entityId("{baseUrl}/saml2/service-provider-metadata/" + globalSPRegistrationId)
7275
.assertionConsumerServiceLocation("{baseUrl}/login/saml2/sso/" + globalSPRegistrationId)

Frontend/projects/edu-sharing-ui/src/lib/list-items/list-text/list-text.component.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
{{ displayName$ | async }}
163163
</ng-container>
164164
<ng-container *ngIf="DATE_FIELDS.includes(item.name)">
165-
{{ $any(getNode()).properties[item.name]?.[0] | formatDate: { async: true, time: true, relative: true } | async }}
165+
{{ ($any(getNode()).properties[item.name + '_LONG']?.[0] || $any(getNode()).properties[item.name]?.[0]) | formatDate: { async: true, time: true, relative: true } | async }}
166166
</ng-container>
167167
<ng-container *ngIf="VCARD_FIELDS.includes(item.name)">
168168
{{

Frontend/src/app/features/dialogs/dialog-modules/license-dialog/license-dialog-content.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ export class LicenseDialogContentComponent implements OnInit {
558558
}
559559

560560
getLicenseUrlVersion(type: string) {
561-
return this.nodeHelper.getLicenseUrlByString(type, this.ccVersion, this.ccCountry);
561+
return this.nodeHelper.getLicenseUrlByString(type, this.ccVersion || '4.0', this.ccCountry);
562562
}
563563

564564
getLicenseIcon() {

0 commit comments

Comments
 (0)