Skip to content

Commit 53c4133

Browse files
committed
Merge remote-tracking branch 'origin/hotfix/2019.1.3' into stable-2019.1
2 parents ecbf6db + 976366c commit 53c4133

File tree

26 files changed

+535
-249
lines changed

26 files changed

+535
-249
lines changed

Platform/Plugins/com.tle.platform.common/src/com/dytech/common/io/FileUtils.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,17 @@ public static boolean delete(Path f, FileCallback callback) {
8282

8383
public static boolean delete(Path f, @Nullable FileCallback callback, boolean failOnError)
8484
throws IOException {
85+
if (LOGGER.isTraceEnabled()) {
86+
// Exposes the code flows that delete files
87+
Exception tracer = new Exception("Debug stack trace - about to delete - " + f.toString());
88+
LOGGER.trace(tracer.getMessage(), tracer);
89+
}
8590
if (!Files.exists(f, LinkOption.NOFOLLOW_LINKS)) {
91+
LOGGER.debug("File does not exist. Could not delete [" + f.toString() + "]");
8692
return true;
8793
}
8894
if (Files.isDirectory(f, LinkOption.NOFOLLOW_LINKS)) {
89-
LOGGER.debug("File is a folder, deleting contents");
95+
LOGGER.debug("File [" + f.toString() + "] is a folder, deleting contents");
9096
try {
9197
final DeleteVisitor visitor = new DeleteVisitor(callback);
9298
Files.walkFileTree(f, EnumSet.noneOf(FileVisitOption.class), Integer.MAX_VALUE, visitor);
@@ -325,6 +331,7 @@ public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOEx
325331
}
326332
try {
327333
Files.delete(dir);
334+
LOGGER.warn("Deleting folder " + dir.toString());
328335
} catch (Exception e) {
329336
success = false;
330337
LOGGER.warn("Folder deletion failed. Could not delete " + dir.toString());

Source/Plugins/Core/com.equella.base/src/com/tle/common/lti/consumers/entity/LtiConsumer.java

+4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@
3535
@Entity
3636
@AccessType("field")
3737
public class LtiConsumer extends BaseEntity {
38+
public static final String ATT_CUSTOM_USER_ID = "ATT_CUSTOM_USER_ID";
39+
public static final String ATT_CUSTOM_USERNAME = "ATT_CUSTOM_USERNAME";
40+
public static final String ATT_CUSTOM_ENABLE_ID_PREFIX = "ATT_CUSTOM_ENABLE_ID_PREFIX";
41+
3842
@Index(name = "consumerKey")
3943
@Column(length = 255, nullable = false)
4044
private String consumerKey;

Source/Plugins/Core/com.equella.core/plugin-jpf.xml

+14-14
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
<parameter id="class" value="com.tle.core.xslt.guice.XsltModule" />
123123
<parameter id="class" value="com.tle.integration.lti.brightspace.guice.BrightspaceIntegrationModule" />
124124
<parameter id="class" value="com.tle.integration.lti.canvasextension.guice.CanvasIntegrationModule" />
125-
<parameter id="class" value="com.tle.integration.lti.blackboard.guice.BlackboardLtiIntegrationModule" />
125+
<parameter id="class" value="com.tle.integration.lti.generic.guice.GenericLtiIntegrationModule" />
126126
<parameter id="class" value="com.tle.integration.standard.guice.StandardIntegrationModule" />
127127
<parameter id="class" value="com.tle.mycontent.guice.MyContentModule" />
128128
<parameter id="class" value="com.tle.mypages.guice.MyPagesModule" />
@@ -2173,9 +2173,9 @@
21732173
<parameter id="id" value="canvas" />
21742174
<parameter id="class" value="bean:com.tle.integration.lti.canvasextension.CanvasIntegration" />
21752175
</extension>
2176-
<extension plugin-id="com.tle.web.integration" point-id="integration" id="blackboardltiintegration">
2177-
<parameter id="id" value="blackboardlti" />
2178-
<parameter id="class" value="bean:com.tle.integration.lti.blackboard.BlackboardLtiIntegration" />
2176+
<extension plugin-id="com.tle.web.integration" point-id="integration" id="genericltiintegration">
2177+
<parameter id="id" value="lti" />
2178+
<parameter id="class" value="bean:com.tle.integration.lti.generic.GenericLtiIntegration" />
21792179
</extension>
21802180
<extension plugin-id="com.tle.web.sections" point-id="sectionTree" id="signon_2">
21812181
<parameter id="path" value="/canvassignon.do" />
@@ -2185,23 +2185,23 @@
21852185
<parameter id="path" value="/canvascipreturn.do" />
21862186
<parameter id="root" value="bean:/canvascipreturn" />
21872187
</extension>
2188-
<extension plugin-id="com.tle.web.sections" point-id="sectionTree" id="signon_blackboardLti">
2189-
<parameter id="path" value="/blackboardltisignon.do" />
2190-
<parameter id="root" value="bean:/blackboardltisignon" />
2188+
<extension plugin-id="com.tle.web.sections" point-id="sectionTree" id="signon_lti">
2189+
<parameter id="path" value="/ltisignon.do" />
2190+
<parameter id="root" value="bean:/ltisignon" />
21912191
</extension>
2192-
<extension plugin-id="com.tle.web.sections" point-id="sectionTree" id="contentItemPlacementsReturnBlackboardLti">
2193-
<parameter id="path" value="/blackboardlticipreturn.do" />
2194-
<parameter id="root" value="bean:/blackboardlticipreturn" />
2192+
<extension plugin-id="com.tle.web.sections" point-id="sectionTree" id="contentItemPlacementsReturnLti">
2193+
<parameter id="path" value="/lticipreturn.do" />
2194+
<parameter id="root" value="bean:/lticipreturn" />
21952195
</extension>
21962196
<extension plugin-id="com.tle.web.lti" point-id="ltiWrapperExtension" id="canvasLtiExt">
21972197
<parameter id="id" value="canvas" />
21982198
<parameter id="bean" value="bean:com.tle.integration.lti.canvasextension.CanvasLtiWrapperExtension" />
21992199
<parameter id="order" value="1000" />
22002200
</extension>
2201-
<extension plugin-id="com.tle.web.lti" point-id="ltiWrapperExtension" id="blackboardLtiExt">
2202-
<parameter id="id" value="bblti" />
2203-
<parameter id="bean" value="bean:com.tle.integration.lti.blackboard.BlackboardLtiWrapperExtension" />
2204-
<parameter id="order" value="1000" />
2201+
<extension plugin-id="com.tle.web.lti" point-id="ltiWrapperExtension" id="genericLtiExt">
2202+
<parameter id="id" value="genlti" />
2203+
<parameter id="bean" value="bean:com.tle.integration.lti.generic.GenericLtiWrapperExtension" />
2204+
<parameter id="order" value="9000" />
22052205
</extension>
22062206
<extension plugin-id="com.tle.web.connectors" point-id="connectorEditor" id="moodleEditor">
22072207
<parameter id="id" value="moodle" />

Source/Plugins/Core/com.equella.core/resources/lang/i18n-resource-centre.properties

+4
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,10 @@ editor.container.option.default=Default
13141314
editor.container.option.embed=Embed
13151315
editor.container.option.newwindow=New window
13161316
editor.customparams=Custom parameters
1317+
editor.custom.lti.params.help=The following custom LTI parameters are only in effect for the /ltisignon.do endpoint
1318+
editor.custom.lti.params.user.id=Custom user ID
1319+
editor.custom.lti.params.username=Custom username attribute
1320+
editor.custom.lti.params.prefix.id=Prefix the user ID with a value unique to this consumer
13171321
editor.dropdown.option.choosetype=Choose a connector type...
13181322
editor.email=Share launcher's email with tool
13191323
editor.error.accessdenied=You do not have the required permission to access this page\: {0}

Source/Plugins/Core/com.equella.core/resources/view/editconsumer.ftl

+14-3
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
<#include "/com.tle.web.sections.standard@/dropdown.ftl" />
77
<#include "/com.tle.web.sections.standard@/textfield.ftl"/>
88
<#include "/com.tle.web.sections.standard@/autocomplete.ftl"/>
9-
109
<@css "editconsumer.css" />
1110

1211
<@setting label=b.key("editor.key") mandatory=true error=m.errors["key"]>
@@ -21,6 +20,18 @@
2120
<@setting label=b.key("editor.postfix") help=b.key("editor.username.help")>
2221
<@textfield section=s.postfixField maxlength=50 />
2322
</@setting>
23+
<hr/>
24+
<@setting label='' help=b.key('editor.custom.lti.params.help') />
25+
<@setting label=b.key("editor.custom.lti.params.user.id")>
26+
<@textfield section=s.customUserIdParameterField maxlength=128 />
27+
</@setting>
28+
<@setting label=b.key("editor.custom.lti.params.username")>
29+
<@textfield section=s.customUsernameParameterField maxlength=128 />
30+
</@setting>
31+
<@setting label=''>
32+
<div class="input checkbox"><@render s.customEnableIdPrefixField /></div>
33+
</@setting>
34+
<hr/>
2435
<@a.div id="allowed">
2536
<@setting label=b.key("editor.allowed.label") help=b.key("editor.allowed.help")>
2637
${m.prettyExpression}
@@ -40,8 +51,8 @@
4051
</@a.div>
4152
<@a.div id="customrole">
4253
<@setting label=b.key("editor.role.custom.label") error=m.errors["nocustomrole"] help=b.key("editor.role.custom.help")>
43-
<@render section=s.customRolesTable />
44-
<@autocomplete section=s.customRoleField class="custom-role" placeholder=b.key("editor.role.custom.placeholder") />
54+
<@render section=s.customRolesTable />
55+
<@autocomplete section=s.customRoleField class="custom-role" placeholder=b.key("editor.role.custom.placeholder") />
4556
<@render section=s.customRoleDialog.opener class="add">${b.key("editor.table.roles.add")}</@render>
4657
</@setting>
4758
</@a.div>

Source/Plugins/Core/com.equella.core/src/com/tle/core/filesystem/staging/service/impl/StagingServiceImpl.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,12 @@ public void removeStagingArea(StagingFile staging, boolean removeFiles) {
6767
if (s == null) {
6868
LOGGER.error("Staging area does not exist");
6969
} else {
70+
LOGGER.debug("Deleting Staging entry in DB [" + s.getStagingID() + "]");
7071
stagingDao.delete(s);
7172
}
7273

7374
if (removeFiles) {
75+
LOGGER.debug("Removing Staging area in the filestore [" + s.getStagingID() + "]");
7476
fileSystemService.removeFile(staging);
7577
}
7678
}
@@ -100,9 +102,10 @@ public void matched(Path file, String relFilepath) {
100102
String uuid = file.getFileName().toString();
101103
if (!stagingExists(uuid)) {
102104
try {
105+
LOGGER.debug("Deleting staging area [" + uuid + "]");
103106
FileUtils.delete(file, null, true);
104107
} catch (IOException ex) {
105-
LOGGER.warn("Could not delete staging area: " + uuid, ex);
108+
LOGGER.warn("Could not delete staging area [" + uuid + "]", ex);
106109
}
107110
}
108111
}

Source/Plugins/Core/com.equella.core/src/com/tle/core/scheduler/impl/SchedulerModule.java

+1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ public class SchedulerModule extends OptionalConfigModule {
2626
protected void configure() {
2727
bindInt("com.tle.core.tasks.RemoveDeletedItems.daysBeforeRemoval");
2828
bindInt("com.tle.core.tasks.RemoveOldAuditLogs.daysBeforeRemoval");
29+
bindBoolean("com.tle.core.tasks.RemoveStagingAreas.enable", true);
2930
}
3031
}

Source/Plugins/Core/com.equella.core/src/com/tle/core/scheduler/standard/task/RemoveStagingAreas.java

+14-1
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,29 @@
2222
import com.tle.core.guice.Bind;
2323
import com.tle.core.scheduler.ScheduledTask;
2424
import javax.inject.Inject;
25+
import javax.inject.Named;
2526
import javax.inject.Singleton;
27+
import org.apache.log4j.Logger;
2628

2729
/** @author Nicholas Read */
2830
@Bind
2931
@Singleton
3032
public class RemoveStagingAreas implements ScheduledTask {
33+
private static final Logger LOGGER = Logger.getLogger(RemoveStagingAreas.class);
34+
3135
@Inject private StagingService stagingService;
3236

37+
@com.google.inject.Inject(optional = true)
38+
@Named("com.tle.core.tasks.RemoveStagingAreas.enable")
39+
// Can be overrode by the optional-config.properties
40+
private boolean enableTask = true;
41+
3342
@Override
3443
public void execute() {
35-
stagingService.removeUnusedStagingAreas();
44+
if (enableTask) {
45+
stagingService.removeUnusedStagingAreas();
46+
} else {
47+
LOGGER.debug("RemoveStagingAreas is disabled. Not running task.");
48+
}
3649
}
3750
}

Source/Plugins/Core/com.equella.core/src/com/tle/core/services/impl/FileSystemServiceImpl.java

+27-12
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ public FileInfo write(
283283
} catch (AccessDeniedException ex) {
284284
String serviceUser = System.getProperty("user.name");
285285
throw new IOException(
286-
"Couldn't create directories on file store. Are you sure that EQUELLA running as '"
286+
"Couldn't create directories on file store. Are you sure that openEQUELLA running as '"
287287
+ serviceUser
288288
+ "' user has the correct permissions?",
289289
ex);
@@ -426,29 +426,44 @@ public void commitFiles(TemporaryFileHandle staging, String folder, FileHandle d
426426
File from = getFile(staging, folder);
427427
File to = getFile(destination);
428428

429-
LOGGER.info("commitFiles: from " + from.getAbsolutePath());
430-
LOGGER.info("commitFiles: to " + to.getAbsolutePath());
429+
final String fromStr = from.getAbsolutePath();
430+
final String toStr = to.getAbsolutePath();
431+
LOGGER.info("commitFiles: from [" + fromStr + "] to [" + toStr + "]");
431432

432433
File trash = null;
433434
if (FileSystemHelper.exists(to)) {
434-
LOGGER.debug("Destination exists renaming");
435+
LOGGER.debug("Destination [" + to + "] exists. Moving to a staging 'trash' folder");
435436
trash = getFile(new TrashFile(staging));
436-
LOGGER.debug("Moving current to trash");
437+
LOGGER.debug("Moving current [" + to + "] to trash [" + trash + "]");
438+
437439
if (!FileSystemHelper.rename(to, trash, false)) {
438440
FileSystemHelper.rename(trash, to, true);
439-
throw new FileSystemException("Couldn't move to Trash.");
441+
throw new FileSystemException("Couldn't move [" + to + "] to trash [" + trash + "].");
440442
}
441443
}
442444

443-
LOGGER.debug("About to rename staging to real item");
445+
LOGGER.debug("About to rename staging [" + from + "] to real item [" + to + "].");
444446
if (!FileSystemHelper.exists(from)) {
445-
LOGGER.debug("no files to commit - making blank dir");
447+
LOGGER.debug("no files to commit - making blank dir [" + to + "]");
446448
FileSystemHelper.mkdir(to);
447449
} else {
448-
LOGGER.debug("Renaming staging to real item");
450+
LOGGER.debug("Renaming staging [" + from + "] to real item [" + to + "]");
449451
if (!FileSystemHelper.rename(from, to, false)) {
452+
LOGGER.debug(
453+
"The rename of staging ["
454+
+ from
455+
+ "] to real item ["
456+
+ to
457+
+ "] didn't work. Trying rename of trash to real item.");
450458
if (trash != null) {
451-
FileSystemHelper.rename(trash, to, true);
459+
if (!FileSystemHelper.rename(trash, to, true)) {
460+
LOGGER.debug(
461+
"The rename of trash ["
462+
+ trash
463+
+ "] to real item ["
464+
+ to
465+
+ "] didn't work. Silently proceeding.");
466+
}
452467
}
453468
throw new FileSystemException(
454469
"Failed to commit to staging: "
@@ -459,10 +474,10 @@ public void commitFiles(TemporaryFileHandle staging, String folder, FileHandle d
459474
}
460475

461476
if (trash != null) {
462-
LOGGER.debug("Deleting trash");
477+
LOGGER.debug("Deleting trash [" + trash + "]");
463478
FileUtils.delete(trash.toPath(), null);
464479
}
465-
LOGGER.debug("Done");
480+
LOGGER.debug("Done committing files from [" + staging + "] to [" + to + "]");
466481
}
467482

468483
@Override

Source/Plugins/Core/com.equella.core/src/com/tle/integration/lti/blackboard/BlackboardLtiWrapperExtension.java

-69
This file was deleted.

0 commit comments

Comments
 (0)