From 3e4f7cc71ed15abff24b8bdbbf792169460e0a4c Mon Sep 17 00:00:00 2001 From: Torsten Simon Date: Fri, 11 Oct 2024 09:20:21 +0200 Subject: [PATCH 1/9] fix:workflow shows deleted files --- .../defaults/src/main/resources/metadatasets/xml/mds.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/config/defaults/src/main/resources/metadatasets/xml/mds.xml b/config/defaults/src/main/resources/metadatasets/xml/mds.xml index f349f2688..6d4f2b649 100644 --- a/config/defaults/src/main/resources/metadatasets/xml/mds.xml +++ b/config/defaults/src/main/resources/metadatasets/xml/mds.xml @@ -1317,7 +1317,13 @@ - + + {"bool":{ + "must":[ + {"term":{"nodeRef.storeRef.protocol":"workspace"}} + ] + }} + From b3dafc654a5bd08e304ad4edd54f692559341194 Mon Sep 17 00:00:00 2001 From: Torsten Simon Date: Fri, 11 Oct 2024 09:47:30 +0200 Subject: [PATCH 2/9] fix:breadcrumbs limit size reasonable and provide overflow tooltip --- .../app/modules/collections/collections.component.scss | 6 +++++- .../components/breadcrumbs/breadcrumbs.component.html | 8 +++++++- .../components/breadcrumbs/breadcrumbs.component.scss | 5 ++++- 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/Frontend/src/app/modules/collections/collections.component.scss b/Frontend/src/app/modules/collections/collections.component.scss index 2ab8fd948..aa3162aee 100644 --- a/Frontend/src/app/modules/collections/collections.component.scss +++ b/Frontend/src/app/modules/collections/collections.component.scss @@ -24,7 +24,11 @@ mat-tab-group { // Use `margin-top` instead of `top` to not create a negative position offset at the bottom of // the container, which could be overlapped by a custom footer. min-height: calc(100vh - var(--mainnavHeight)); - + .collections-right { + // fix breadcrumbs overflow + max-width: calc(100vw - $sidenavWidth); + overflow-x: hidden; + } &.collectionsContainerTabs { min-height: calc(100vh - (var(--mainnavHeight) + 48px)); } diff --git a/Frontend/src/app/shared/components/breadcrumbs/breadcrumbs.component.html b/Frontend/src/app/shared/components/breadcrumbs/breadcrumbs.component.html index 734ca7403..68fa6868a 100644 --- a/Frontend/src/app/shared/components/breadcrumbs/breadcrumbs.component.html +++ b/Frontend/src/app/shared/components/breadcrumbs/breadcrumbs.component.html @@ -175,7 +175,13 @@ (nodeDropped)="onDropped($event)" class="breadcrumb-element" > - + {{ 'BREADCRUMB_LOCATION_PREFIX' | translate }} diff --git a/Frontend/src/app/shared/components/breadcrumbs/breadcrumbs.component.scss b/Frontend/src/app/shared/components/breadcrumbs/breadcrumbs.component.scss index 98bf95387..a3ad93b84 100644 --- a/Frontend/src/app/shared/components/breadcrumbs/breadcrumbs.component.scss +++ b/Frontend/src/app/shared/components/breadcrumbs/breadcrumbs.component.scss @@ -104,11 +104,14 @@ button { .breadcrumb-inner { color: $primary; - display: flex; + display: block; padding: 2px 4px; gap: 3px; white-space: nowrap; align-items: center; + max-width: 300px; + overflow: hidden; + text-overflow: ellipsis; } .breadcrumb-readonly .breadcrumb-element:not(.breadcrumb-element-active) { From f16b5853cce0de2e978619eb91034bbdd27aa27c Mon Sep 17 00:00:00 2001 From: Sebastian Wollner Date: Fri, 11 Oct 2024 10:24:27 +0200 Subject: [PATCH 3/9] fix: NullPointerException in CCConstants.getValidGlobalName --- .../org/edu_sharing/repository/client/tools/CCConstants.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Backend/alfresco/common/src/main/java/org/edu_sharing/repository/client/tools/CCConstants.java b/Backend/alfresco/common/src/main/java/org/edu_sharing/repository/client/tools/CCConstants.java index 29cbd2117..444f8c6f0 100644 --- a/Backend/alfresco/common/src/main/java/org/edu_sharing/repository/client/tools/CCConstants.java +++ b/Backend/alfresco/common/src/main/java/org/edu_sharing/repository/client/tools/CCConstants.java @@ -2140,6 +2140,10 @@ public static String getValidLocalName(String value){ * @return */ public static String getValidGlobalName(String value){ + if(value == null){ + return null; + } + for(Map.Entry entry: getNameSpaceMap().entrySet()){ if(value.startsWith(entry.getValue())){ return "{" + entry.getKey() + "}" + value.substring(entry.getValue().length() + 1); From 87ee33850d4f696d29c6e69976ed680629c31fbd Mon Sep 17 00:00:00 2001 From: Daniel Rudolph Date: Fri, 11 Oct 2024 11:44:15 +0200 Subject: [PATCH 4/9] fix: classification_keyword_display not copied by MetadataPresettingPolicy --- .../fixes/MetadataPresettingPolicy.java | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/Backend/alfresco/module/src/main/java/org/edu_sharing/alfresco/fixes/MetadataPresettingPolicy.java b/Backend/alfresco/module/src/main/java/org/edu_sharing/alfresco/fixes/MetadataPresettingPolicy.java index 4f56b2d38..900817c5b 100644 --- a/Backend/alfresco/module/src/main/java/org/edu_sharing/alfresco/fixes/MetadataPresettingPolicy.java +++ b/Backend/alfresco/module/src/main/java/org/edu_sharing/alfresco/fixes/MetadataPresettingPolicy.java @@ -19,11 +19,10 @@ import org.edu_sharing.metadataset.v2.MetadataWidget; import org.edu_sharing.repository.client.tools.CCConstants; import org.edu_sharing.repository.server.tools.ApplicationInfoList; +import org.springframework.util.StringUtils; import java.io.Serializable; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; +import java.util.*; public class MetadataPresettingPolicy implements NodeServicePolicies.OnCreateNodePolicy, @@ -191,23 +190,29 @@ private void inheritMetadata(NodeRef parentRef,NodeRef templateRef,NodeRef targe try { MetadataSet mds = MetadataReader.getMetadataset(ApplicationInfoList.getHomeRepository(), mdsId,"default"); for(MetadataWidget widget : mds.getWidgetsByTemplate("io_template")){ - QName prop = QName.createQName(CCConstants.getValidGlobalName(widget.getId())); - Serializable value = nodeService.getProperty(templateRef, prop); - Serializable current = nodeService.getProperty(targetRef, prop); - if(value!=null) { - // mutli value: try to merge the values - if(widget.isMultivalue() && current!=null && current instanceof List && value instanceof List){ - List currentList = (List) current; - List valueList = (List) value; - for(Object v : valueList){ - if(!currentList.contains(v)){ - currentList.add(v); + Set props = new HashSet(); + props.add(QName.createQName(CCConstants.getValidGlobalName(widget.getId()))); + if(StringUtils.hasText(widget.getSuggestDisplayProperty())){ + props.add(QName.createQName(CCConstants.getValidGlobalName(widget.getSuggestDisplayProperty()))); + } + for(QName prop : props){ + Serializable value = nodeService.getProperty(templateRef, prop); + Serializable current = nodeService.getProperty(targetRef, prop); + if(value!=null) { + // mutli value: try to merge the values + if(widget.isMultivalue() && current!=null && current instanceof List && value instanceof List){ + List currentList = (List) current; + List valueList = (List) value; + for(Object v : valueList){ + if(!currentList.contains(v)){ + currentList.add(v); + } } + nodeService.setProperty(targetRef,prop, (Serializable) currentList); + } + else{ + nodeService.setProperty(targetRef, prop, value); } - nodeService.setProperty(targetRef,prop, (Serializable) currentList); - } - else{ - nodeService.setProperty(targetRef, prop, value); } } } From 74a49a7c2684577db6f2156007303e033da385dd Mon Sep 17 00:00:00 2001 From: Torsten Simon Date: Fri, 11 Oct 2024 12:55:26 +0200 Subject: [PATCH 5/9] fix:logout allow switching url between local and sso users --- .../service/config/model/LogoutInfo.java | 22 +++++++++++++++++++ .../rest/api/src/main/resources/openapi.json | 6 +++++ .../edu-sharing-api/src/lib/models.ts | 2 ++ .../edu-sharing-api/src/lib/rest-constants.ts | 2 ++ 4 files changed, 32 insertions(+) diff --git a/Backend/alfresco/module/src/main/java/org/edu_sharing/alfresco/service/config/model/LogoutInfo.java b/Backend/alfresco/module/src/main/java/org/edu_sharing/alfresco/service/config/model/LogoutInfo.java index e1d992359..155be36d1 100644 --- a/Backend/alfresco/module/src/main/java/org/edu_sharing/alfresco/service/config/model/LogoutInfo.java +++ b/Backend/alfresco/module/src/main/java/org/edu_sharing/alfresco/service/config/model/LogoutInfo.java @@ -4,8 +4,30 @@ import java.io.Serializable; public class LogoutInfo implements Serializable { + /** + * url to navigate to + */ @XmlElement public String url; + /** + * url for locale users + * if not set, url will be used + */ + @XmlElement public String localUrl; + /** + * url for shibboleth or sso users + * if not set, url will be used + */ + @XmlElement public String ssoUrl; + /** + * destroy the local session? + */ @XmlElement public Boolean destroySession; + /** + * call the given url via ajax (true) or navigate via browser (false) + */ @XmlElement public Boolean ajax; + /** + * only if ajax: url to navigate the browser to after triggering "url" via ajax. + */ @XmlElement public String next; } diff --git a/Backend/services/rest/api/src/main/resources/openapi.json b/Backend/services/rest/api/src/main/resources/openapi.json index a38b1f923..997d5d68f 100644 --- a/Backend/services/rest/api/src/main/resources/openapi.json +++ b/Backend/services/rest/api/src/main/resources/openapi.json @@ -2387,9 +2387,15 @@ "destroySession": { "type": "boolean" }, + "localUrl": { + "type": "string" + }, "next": { "type": "string" }, + "ssoUrl": { + "type": "string" + }, "url": { "type": "string" } diff --git a/Frontend/projects/edu-sharing-api/src/lib/models.ts b/Frontend/projects/edu-sharing-api/src/lib/models.ts index c81d10b8d..91c8aab12 100644 --- a/Frontend/projects/edu-sharing-api/src/lib/models.ts +++ b/Frontend/projects/edu-sharing-api/src/lib/models.ts @@ -23,6 +23,8 @@ export { MdsWidgetCondition, MetadataSetInfo, NotificationEventDto as Notification, + Config, + Values as ConfigValues, ConfigTutorial, Mediacenter, NotificationConfig, diff --git a/Frontend/projects/edu-sharing-api/src/lib/rest-constants.ts b/Frontend/projects/edu-sharing-api/src/lib/rest-constants.ts index ecee5ea9f..bbda8711e 100644 --- a/Frontend/projects/edu-sharing-api/src/lib/rest-constants.ts +++ b/Frontend/projects/edu-sharing-api/src/lib/rest-constants.ts @@ -85,6 +85,8 @@ export class RestConstants { public static CCM_PROP_WF_INSTRUCTIONS = 'ccm:wf_instructions'; public static CCM_PROP_WF_PROTOCOL = 'ccm:wf_protocol'; public static CCM_PROP_REPLICATIONSOURCE = 'ccm:replicationsource'; + public static CM_PROP_ESSSOTYPE = 'cm:esssotype'; + public static SSO_TYPE_Shibboleth = 'shibboleth'; public static CCM_PROP_REPLICATIONMODIFIED = 'ccm:replicationmodified'; public static CCM_PROP_REPLICATIONSOURCETIMESTAMP = 'ccm:replicationsourcetimestamp'; public static CCM_PROP_EDUSCOPENAME = 'ccm:eduscopename'; From 96211957e4c660505d1c836da524274793d4ef36 Mon Sep 17 00:00:00 2001 From: Torsten Simon Date: Fri, 11 Oct 2024 12:55:48 +0200 Subject: [PATCH 6/9] build:update submodule --- Frontend/src/app/core-module | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Frontend/src/app/core-module b/Frontend/src/app/core-module index afbb38ec1..e7607167b 160000 --- a/Frontend/src/app/core-module +++ b/Frontend/src/app/core-module @@ -1 +1 @@ -Subproject commit afbb38ec19bf521f26d1225261775e897b419aac +Subproject commit e7607167b95a8102d0690c99f57f3f3c681ef87c From d2c215dba23c34dfc6a2e547a07db5abcbf3e145 Mon Sep 17 00:00:00 2001 From: Daniel Rudolph Date: Fri, 11 Oct 2024 13:57:31 +0200 Subject: [PATCH 7/9] fix: classification_keyword_display not copied by MetadataPresettingPolicy: BulkEditNodesJob Consumer --- .../importer/FactualTermBulkEditConsumer.java | 21 ++++++++ .../importer/FactualTermDisplayUpdater.java | 48 +++++++++++-------- 2 files changed, 50 insertions(+), 19 deletions(-) create mode 100644 Backend/services/core/src/main/java/org/edu_sharing/repository/server/importer/FactualTermBulkEditConsumer.java diff --git a/Backend/services/core/src/main/java/org/edu_sharing/repository/server/importer/FactualTermBulkEditConsumer.java b/Backend/services/core/src/main/java/org/edu_sharing/repository/server/importer/FactualTermBulkEditConsumer.java new file mode 100644 index 000000000..345ab5e14 --- /dev/null +++ b/Backend/services/core/src/main/java/org/edu_sharing/repository/server/importer/FactualTermBulkEditConsumer.java @@ -0,0 +1,21 @@ +package org.edu_sharing.repository.server.importer; + +import org.alfresco.service.cmr.repository.NodeRef; + +public class FactualTermBulkEditConsumer implements java.util.function.Consumer{ + + FactualTermDisplayUpdater updater; + + public FactualTermBulkEditConsumer(){ + try { + updater = new FactualTermDisplayUpdater(); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + @Override + public void accept(NodeRef nodeRef) { + updater.resetDisplayProperty(nodeRef); + } +} diff --git a/Backend/services/core/src/main/java/org/edu_sharing/repository/server/importer/FactualTermDisplayUpdater.java b/Backend/services/core/src/main/java/org/edu_sharing/repository/server/importer/FactualTermDisplayUpdater.java index 587a6b036..12e08d3a4 100644 --- a/Backend/services/core/src/main/java/org/edu_sharing/repository/server/importer/FactualTermDisplayUpdater.java +++ b/Backend/services/core/src/main/java/org/edu_sharing/repository/server/importer/FactualTermDisplayUpdater.java @@ -64,26 +64,37 @@ private void runforStore(String key, StoreRef storeRef) throws IllegalArgumentEx } for(NodeRef nodeRef : nodeRefs){ - List keys = (List) nodeService.getProperty(nodeRef, QName.createQName(CCConstants.CCM_PROP_IO_REPL_CLASSIFICATION_KEYWORD)); - ArrayList displays = new ArrayList<>(); - for(String k : keys){ - List suggestions = MetadataSearchHelper.getSuggestions(appId, mds, "ngsearch", - CCConstants.getValidLocalName(CCConstants.CCM_PROP_IO_REPL_CLASSIFICATION_KEYWORD), k, null); - displays.add(suggestions.get(0).getDisplayString()); - } - logger.info("updateing;"+nodeRef+";"+ key); - serviceRegistry.getRetryingTransactionHelper().doInTransaction(()->{ - try { + resetDisplayProperty(key, nodeRef); + } + } - policyBehaviourFilter.disableBehaviour(nodeRef); - setProperty(nodeRef,QName.createQName(CCConstants.CCM_PROP_IO_REPL_CLASSIFICATION_KEYWORD_DISPLAY),displays); - new RepositoryCache().remove(nodeRef.getId()); - }finally { - policyBehaviourFilter.enableBehaviour(nodeRef); - } - return null; - }); + public void resetDisplayProperty(NodeRef nodeRef){ + resetDisplayProperty(null, nodeRef); + } + + private void resetDisplayProperty(String key, NodeRef nodeRef) { + List keys = (List) nodeService.getProperty(nodeRef, QName.createQName(CCConstants.CCM_PROP_IO_REPL_CLASSIFICATION_KEYWORD)); + if(keys == null || keys.size() == 0){ + return; + } + ArrayList displays = new ArrayList<>(); + for(String k : keys){ + List suggestions = MetadataSearchHelper.getSuggestions(appId, mds, "ngsearch", + CCConstants.getValidLocalName(CCConstants.CCM_PROP_IO_REPL_CLASSIFICATION_KEYWORD), k, null); + displays.add(suggestions.get(0).getDisplayString()); } + logger.info("updateing;"+ nodeRef +";"+ key); + serviceRegistry.getRetryingTransactionHelper().doInTransaction(()->{ + try { + + policyBehaviourFilter.disableBehaviour(nodeRef); + setProperty(nodeRef,QName.createQName(CCConstants.CCM_PROP_IO_REPL_CLASSIFICATION_KEYWORD_DISPLAY),displays); + new RepositoryCache().remove(nodeRef.getId()); + }finally { + policyBehaviourFilter.enableBehaviour(nodeRef); + } + return null; + }); } private void setProperty(NodeRef nodeRef, QName qName, Serializable serializable){ @@ -93,5 +104,4 @@ private void setProperty(NodeRef nodeRef, QName qName, Serializable serializable nodeService.setProperty(nodeRef, qnameV, serializable); } } - } From c008689110ff8e6e01940ccb8e899e69fd6db848 Mon Sep 17 00:00:00 2001 From: Daniel Rudolph Date: Fri, 11 Oct 2024 14:03:45 +0200 Subject: [PATCH 8/9] fix: classification_keyword_display not copied by MetadataPresettingPolicy: BulkEditNodesJob Consumer errorhandling --- .../server/importer/FactualTermDisplayUpdater.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Backend/services/core/src/main/java/org/edu_sharing/repository/server/importer/FactualTermDisplayUpdater.java b/Backend/services/core/src/main/java/org/edu_sharing/repository/server/importer/FactualTermDisplayUpdater.java index 12e08d3a4..f7e542df3 100644 --- a/Backend/services/core/src/main/java/org/edu_sharing/repository/server/importer/FactualTermDisplayUpdater.java +++ b/Backend/services/core/src/main/java/org/edu_sharing/repository/server/importer/FactualTermDisplayUpdater.java @@ -81,8 +81,16 @@ private void resetDisplayProperty(String key, NodeRef nodeRef) { for(String k : keys){ List suggestions = MetadataSearchHelper.getSuggestions(appId, mds, "ngsearch", CCConstants.getValidLocalName(CCConstants.CCM_PROP_IO_REPL_CLASSIFICATION_KEYWORD), k, null); + if(suggestions == null || suggestions.size() == 0){ + logger.info("no caption value found for key: " + k +" nodeRef:"+nodeRef); + continue; + } displays.add(suggestions.get(0).getDisplayString()); } + if(displays.size() == 0){ + logger.info("no caption values found nodeRef:" + nodeRef); + return; + } logger.info("updateing;"+ nodeRef +";"+ key); serviceRegistry.getRetryingTransactionHelper().doInTransaction(()->{ try { From 66f5565838f9b7d149bee7c6ec8736ba0121ba69 Mon Sep 17 00:00:00 2001 From: Daniel Rudolph Date: Fri, 11 Oct 2024 15:07:27 +0200 Subject: [PATCH 9/9] fix: LTI use RunAsSystem when LTI Node is embedded in lms and user has SingleUseNodeId permission --- .../ltiplatform/v13/LTIPlatformApi.java | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/Backend/services/core/src/main/java/org/edu_sharing/restservices/ltiplatform/v13/LTIPlatformApi.java b/Backend/services/core/src/main/java/org/edu_sharing/restservices/ltiplatform/v13/LTIPlatformApi.java index 811150e77..1df3e68ec 100644 --- a/Backend/services/core/src/main/java/org/edu_sharing/restservices/ltiplatform/v13/LTIPlatformApi.java +++ b/Backend/services/core/src/main/java/org/edu_sharing/restservices/ltiplatform/v13/LTIPlatformApi.java @@ -669,16 +669,19 @@ public Response generateLoginInitiationFormResourceLink(@Parameter(description = @Context HttpServletRequest req){ try{ - if(jwt != null){ - Jws claimsJws = LTIJWTUtil.validateJWT(jwt, ApplicationInfoList.getHomeRepository()); - String jwtNodeId = (String)claimsJws.getBody().get(CCConstants.NODEID); - if(jwtNodeId == null){ - throw new Exception("nodeId not found in validated jwt"); - } - if(!jwtNodeId.equals(nodeId)){ - throw new Exception("wrong nodeId found in validated jwt"); + if(jwt != null || org.edu_sharing.alfresco.repository.server.authentication.Context.getCurrentInstance().isSingleUseNodeId(nodeId)){ + if(jwt != null){ + Jws claimsJws = LTIJWTUtil.validateJWT(jwt, ApplicationInfoList.getHomeRepository()); + String jwtNodeId = (String)claimsJws.getBody().get(CCConstants.NODEID); + if(jwtNodeId == null){ + throw new Exception("nodeId not found in validated jwt"); + } + if(!jwtNodeId.equals(nodeId)){ + throw new Exception("wrong nodeId found in validated jwt"); + } } return AuthenticationUtil.runAsSystem(() -> generateLoginInitationResouceLinkRaw(nodeId, editMode, version, launchPresentation, req)); + }else{ return generateLoginInitationResouceLinkRaw(nodeId, editMode, version, launchPresentation, req); }