Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/maven/fixes/9.0' into maven/rele…
Browse files Browse the repository at this point in the history
…ase/9.0
  • Loading branch information
metaventis-build committed Oct 11, 2024
2 parents 1ce88dc + 66f5565 commit 3e15861
Show file tree
Hide file tree
Showing 14 changed files with 152 additions and 50 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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<String,String> entry: getNameSpaceMap().entrySet()){
if(value.startsWith(entry.getValue())){
return "{" + entry.getKey() + "}" + value.substring(entry.getValue().length() + 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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<QName> 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);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
@@ -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<NodeRef>{

FactualTermDisplayUpdater updater;

public FactualTermBulkEditConsumer(){
try {
updater = new FactualTermDisplayUpdater();
} catch (Exception e) {
throw new RuntimeException(e);
}
}

@Override
public void accept(NodeRef nodeRef) {
updater.resetDisplayProperty(nodeRef);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -64,26 +64,45 @@ private void runforStore(String key, StoreRef storeRef) throws IllegalArgumentEx
}

for(NodeRef nodeRef : nodeRefs){
List<String> keys = (List<String>) nodeService.getProperty(nodeRef, QName.createQName(CCConstants.CCM_PROP_IO_REPL_CLASSIFICATION_KEYWORD));
ArrayList<String> displays = new ArrayList<>();
for(String k : keys){
List<? extends Suggestion> 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<String> keys = (List<String>) nodeService.getProperty(nodeRef, QName.createQName(CCConstants.CCM_PROP_IO_REPL_CLASSIFICATION_KEYWORD));
if(keys == null || keys.size() == 0){
return;
}
ArrayList<String> displays = new ArrayList<>();
for(String k : keys){
List<? extends Suggestion> 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 {

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){
Expand All @@ -93,5 +112,4 @@ private void setProperty(NodeRef nodeRef, QName qName, Serializable serializable
nodeService.setProperty(nodeRef, qnameV, serializable);
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -669,16 +669,19 @@ public Response generateLoginInitiationFormResourceLink(@Parameter(description =
@Context HttpServletRequest req){
try{

if(jwt != null){
Jws<Claims> 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<Claims> 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);
}
Expand Down
6 changes: 6 additions & 0 deletions Backend/services/rest/api/src/main/resources/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2387,9 +2387,15 @@
"destroySession": {
"type": "boolean"
},
"localUrl": {
"type": "string"
},
"next": {
"type": "string"
},
"ssoUrl": {
"type": "string"
},
"url": {
"type": "string"
}
Expand Down
2 changes: 2 additions & 0 deletions Frontend/projects/edu-sharing-api/src/lib/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ export {
MdsWidgetCondition,
MetadataSetInfo,
NotificationEventDto as Notification,
Config,
Values as ConfigValues,
ConfigTutorial,
Mediacenter,
NotificationConfig,
Expand Down
2 changes: 2 additions & 0 deletions Frontend/projects/edu-sharing-api/src/lib/rest-constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion Frontend/src/app/core-module
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,13 @@
(nodeDropped)="onDropped($event)"
class="breadcrumb-element"
>
<span class="breadcrumb-inner" [class.breadcrumb-inner-active]="currentPos">
<span
class="breadcrumb-inner"
[class.breadcrumb-inner-active]="currentPos"
esCheckTextOverflow
#text="esCheckTextOverflow"
[matTooltip]="text.hasTextOverflow() ? (node ? node.name : '') : null"
>
<span *ngIf="currentPos && invisibleDescription" class="cdk-visually-hidden">
{{ 'BREADCRUMB_LOCATION_PREFIX' | translate }}
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 7 additions & 1 deletion config/defaults/src/main/resources/metadatasets/xml/mds.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1317,7 +1317,13 @@
</basequery>
</query>
<query join="AND" id="workflowReceive">
<basequery/>
<basequery>
{"bool":{
"must":[
{"term":{"nodeRef.storeRef.protocol":"workspace"}}
]
}}
</basequery>
</query>
<query join="AND" id="workspace">
<property name="ngsearchword">
Expand Down

0 comments on commit 3e15861

Please sign in to comment.