Skip to content

Commit 32861fe

Browse files
committed
Merge branch 'release/2021.1.0'
2 parents 7d0a7ed + 6ebf242 commit 32861fe

File tree

257 files changed

+21901
-17798
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

257 files changed

+21901
-17798
lines changed

.github/workflows/ci.yaml

+30-22
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,15 @@ jobs:
5555
id: nvm
5656

5757
- name: Setup node
58-
uses: actions/setup-node@v1
58+
uses: actions/setup-node@v2
5959
with:
6060
node-version: "${{ steps.nvm.outputs.NVMRC }}"
6161

6262
- name: Set up JDK 1.8
63-
uses: actions/setup-java@v1
63+
uses: actions/setup-java@v2
6464
with:
65-
java-version: 1.8
65+
distribution: adopt
66+
java-version: 8
6667

6768
- name: Install node dependencies (core)
6869
working-directory: Source/Plugins/Core/com.equella.core/js
@@ -105,7 +106,7 @@ jobs:
105106
target/*.zip
106107
107108
- name: Save primary artefacts
108-
uses: actions/[email protected].1
109+
uses: actions/[email protected].3
109110
with:
110111
name: Artefacts
111112
path: artefacts.tar
@@ -130,7 +131,7 @@ jobs:
130131
id: nvm
131132

132133
- name: Setup node
133-
uses: actions/setup-node@v1
134+
uses: actions/setup-node@v2
134135
with:
135136
node-version: "${{ steps.nvm.outputs.NVMRC }}"
136137

@@ -150,7 +151,7 @@ jobs:
150151
tar cvf storybook.tar storybook-static
151152
152153
- name: Save Static Storybook instance
153-
uses: actions/[email protected].1
154+
uses: actions/[email protected].3
154155
with:
155156
name: Storybook
156157
path: Source/Plugins/Core/com.equella.core/js/storybook.tar
@@ -161,17 +162,18 @@ jobs:
161162
- uses: actions/checkout@v1
162163

163164
- name: Set up JDK 1.8
164-
uses: actions/setup-java@v1
165+
uses: actions/setup-java@v2
165166
with:
166-
java-version: 1.8
167+
distribution: adopt
168+
java-version: 8
167169

168170
- name: Build
169171
working-directory: import-export-tool
170172
run: |
171173
./gradlew build
172174
173175
- name: Save primary artefacts
174-
uses: actions/[email protected].1
176+
uses: actions/[email protected].3
175177
with:
176178
name: ImportExportTools
177179
path: import-export-tool/build/libs/
@@ -184,11 +186,15 @@ jobs:
184186
strategy:
185187
matrix:
186188
newui: [true, false]
189+
pgsql-image: [latest, 9.6]
190+
exclude:
191+
- newui: false
192+
pgsql-image: latest
187193
fail-fast: false
188194

189195
services:
190196
postgres:
191-
image: postgres:9.6
197+
image: postgres:${{ matrix.pgsql-image }}
192198
env:
193199
POSTGRES_USER: equellatests
194200
POSTGRES_PASSWORD: password
@@ -220,9 +226,10 @@ jobs:
220226
sudo ln -s /usr/bin/ffprobe /usr/bin/avprobe
221227
222228
- name: Set up JDK 1.8
223-
uses: actions/setup-java@v1
229+
uses: actions/setup-java@v2
224230
with:
225-
java-version: 1.8
231+
distribution: adopt
232+
java-version: 8
226233

227234
- uses: actions/checkout@v1
228235

@@ -254,7 +261,7 @@ jobs:
254261
255262
- name: Save Scalacheck results
256263
if: matrix.newui && failure()
257-
uses: actions/[email protected].1
264+
uses: actions/[email protected].3
258265
with:
259266
name: ScalacheckReports
260267
path: autotest/Tests/target/test-reports
@@ -266,21 +273,21 @@ jobs:
266273
267274
- name: Save TestNG Reports
268275
if: failure()
269-
uses: actions/[email protected].1
276+
uses: actions/[email protected].3
270277
with:
271278
name: TestNGReports-new-${{ matrix.newui }}
272279
path: autotest/OldTests/target/testng
273280

274281
- name: Save oEQ Logs
275282
if: failure()
276-
uses: actions/[email protected].1
283+
uses: actions/[email protected].3
277284
with:
278285
name: oEQLogs-new-${{ matrix.newui }}
279286
path: autotest/equella-install/logs
280287

281288
- name: Save Screenshots
282289
if: failure()
283-
uses: actions/[email protected].1
290+
uses: actions/[email protected].3
284291
with:
285292
name: Screenshots-new-${{ matrix.newui }}
286293
path: autotest/Tests/target/test-reports/screenshots
@@ -298,7 +305,7 @@ jobs:
298305
tar cvf coverage_report.tar autotest/target/coverage-report/
299306
300307
- name: Save Coverage Report
301-
uses: actions/[email protected].1
308+
uses: actions/[email protected].3
302309
with:
303310
name: CoverageReport-newui-${{ matrix.newui }}
304311
path: coverage_report.tar
@@ -310,7 +317,7 @@ jobs:
310317

311318
services:
312319
postgres:
313-
image: postgres:9.6
320+
image: postgres:latest
314321
env:
315322
POSTGRES_USER: equellatests
316323
POSTGRES_PASSWORD: password
@@ -342,9 +349,10 @@ jobs:
342349
sudo ln -s /usr/bin/ffprobe /usr/bin/avprobe
343350
344351
- name: Set up JDK 1.8
345-
uses: actions/setup-java@v1
352+
uses: actions/setup-java@v2
346353
with:
347-
java-version: 1.8
354+
distribution: adopt
355+
java-version: 8
348356

349357
- name: Download installer
350358
uses: actions/download-artifact@v1
@@ -370,7 +378,7 @@ jobs:
370378
id: nvm
371379

372380
- name: Setup node
373-
uses: actions/setup-node@v1
381+
uses: actions/setup-node@v2
374382
with:
375383
node-version: "${{ steps.nvm.outputs.NVMRC }}"
376384

@@ -387,7 +395,7 @@ jobs:
387395
388396
- name: Save oEQ logs for REST Module
389397
if: failure()
390-
uses: actions/[email protected].1
398+
uses: actions/[email protected].3
391399
with:
392400
name: oEQ-logs-rest-module
393401
path: autotest/equella-install/logs

.nvmrc

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
12.20.0
1+
14.16.1

Platform/Plugins/com.tle.platform.common/src/com/tle/common/Check.java

+7
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,13 @@ public static void checkNotNegative(Number... ns) {
8181
}
8282
}
8383

84+
/**
85+
* Returns {@code true} if the string is {@code null} or is zero length <strong>after</strong>
86+
* trimming.
87+
*
88+
* @param s a possible string to test
89+
* @return true if empty, false if has length greater than zero after trimming.
90+
*/
8491
public static boolean isEmpty(String s) {
8592
return s == null || s.trim().length() == 0;
8693
}

Platform/Plugins/com.tle.web.sections/src/com/tle/web/sections/render/TextUtils.java

+22-8
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@
2020

2121
import com.tle.common.Check;
2222
import java.util.ArrayList;
23+
import java.util.Arrays;
2324
import java.util.Collection;
2425
import java.util.Stack;
2526
import java.util.regex.Matcher;
2627
import java.util.regex.Pattern;
28+
import java.util.stream.Stream;
2729

2830
/** @author aholland */
2931
public final class TextUtils {
@@ -69,6 +71,18 @@ public String mostOccurences(String text, int maxLength, Collection<String> term
6971
return text;
7072
}
7173

74+
/**
75+
* Tokenize a text by regex and put each split text into an array. And return a Stream whose
76+
* source is the array.
77+
*
78+
* @param text Text to be processed.
79+
* @param regex Regex used to tokenize the text.
80+
* @return A Stream containing an array created by tokenizing the provided text.
81+
*/
82+
public static Stream<String> tokenizeString(String text, String regex) {
83+
return Arrays.stream(text.split(regex)).filter(s -> !Check.isEmpty(s));
84+
}
85+
7286
private String returnMatchingFraction(String text, Collection<String> terms, int maxLength) {
7387
ArrayList<Integer> positions = new ArrayList<Integer>();
7488

@@ -96,13 +110,13 @@ private String returnMatchingFraction(String text, Collection<String> terms, int
96110
// the beginning
97111
if (prePosition > 2 * WORDS_SPACE_LENGTH) {
98112
sub.append((char) 0x2026);
99-
sub.append(text.substring(curPosition - WORDS_SPACE_LENGTH, curPosition));
113+
sub.append(text, curPosition - WORDS_SPACE_LENGTH, curPosition);
100114
} else {
101-
sub.append(text.substring(0, curPosition));
115+
sub.append(text, 0, curPosition);
102116
}
103117

104118
if (positions.size() == 2) {
105-
sub.append(text.substring(curPosition, text.length()));
119+
sub.append(text.substring(curPosition));
106120
}
107121
}
108122

@@ -112,25 +126,25 @@ private String returnMatchingFraction(String text, Collection<String> terms, int
112126
// two terms are too far from each other then add'...' in
113127
// between
114128
if (curPosition - prePosition > 2 * WORDS_SPACE_LENGTH) {
115-
sub.append(text.substring(prePosition, prePosition + WORDS_SPACE_LENGTH));
129+
sub.append(text, prePosition, prePosition + WORDS_SPACE_LENGTH);
116130
sub.append((char) 0x2026);
117-
sub.append(text.substring(curPosition - WORDS_SPACE_LENGTH, curPosition));
131+
sub.append(text, curPosition - WORDS_SPACE_LENGTH, curPosition);
118132
}
119133
// two terms are close to each other
120134
else {
121-
sub.append(text.substring(prePosition, curPosition));
135+
sub.append(text, prePosition, curPosition);
122136
}
123137
}
124138
// found terms' end positions
125139
if (index % 2 != 0 && index >= 3) {
126140
int prePosition = positions.get(index - 1);
127141
// handle the ending
128142
if (index == positions.size() - 1) {
129-
sub.append(text.substring(prePosition, text.length()));
143+
sub.append(text.substring(prePosition));
130144
}
131145
// concatenate search terms
132146
else {
133-
sub.append(text.substring(prePosition, curPosition));
147+
sub.append(text, prePosition, curPosition);
134148
}
135149
}
136150
}

Source/Plugins/Admin/com.tle.web.adminconsole/jarsrc/build.sbt

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
val springVersion = "5.2.9.RELEASE"
1+
val springVersion = "5.3.5"
22

33
libraryDependencies ++= Seq(
44
"com.github.equella.jpf" % "jpf" % "1.0.7",
@@ -18,7 +18,7 @@ excludeDependencies ++= Seq(
1818
// Spring 5 added a default logging bridge. In oEQ, this results in
1919
// a [deduplicate: different file contents found in the following] error
2020
// ...org.slf4j/jcl-over-slf4j/jars/jcl-over-slf4j-1.7.30.jar:org/apache/commons/logging/Log.class
21-
// ...org.springframework/spring-jcl/jars/spring-jcl-5.2.9.RELEASE.jar:org/apache/commons/logging/Log.class
21+
// ...org.springframework/spring-jcl/jars/spring-jcl-5.3.5.jar:org/apache/commons/logging/Log.class
2222
// As per https://github.com/spring-projects/spring-framework/issues/20611 ,
2323
// since we already have logging in place, we can safely exclude the dep from spring.
2424
"org.springframework" % "spring-jcl"

Source/Plugins/Applet/com.tle.web.filemanager.applet/appletsrc/build.sbt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
val springVersion = "5.2.9.RELEASE"
1+
val springVersion = "5.3.5"
22

33
libraryDependencies ++= Seq(
44
"com.google.guava" % "guava" % "18.0",

Source/Plugins/Core/com.equella.base/src/com/tle/common/security/PrivilegeTree.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ public enum Node {
182182
private final boolean virtual;
183183
private final int overridePriority;
184184

185-
private Node(boolean virtual, int overridePriority) {
185+
Node(boolean virtual, int overridePriority) {
186186
this.virtual = virtual;
187187
this.overridePriority = overridePriority;
188188
}
@@ -418,6 +418,7 @@ private static synchronized void ensureMapping() {
418418
PrivilegeNode itemDefinition = itemDefinitions.getChildren().get(0);
419419
itemDefinition.registerPrivilege("SEARCH_COLLECTION");
420420
itemDefinition.registerPrivilege("CREATE_ITEM");
421+
itemDefinition.registerPrivilege(SecurityConstants.EXPORT_SEARCH_RESULT);
421422
itemDefinition.getChildren().add(itemStatus);
422423
itemDefinition.getChildren().add(itemMetadata);
423424

Source/Plugins/Core/com.equella.base/src/com/tle/common/security/SecurityConstants.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ public final class SecurityConstants {
2929
public static final char REVOKE = 'R';
3030

3131
@Deprecated
32-
public static enum PrivilegeType {
32+
public enum PrivilegeType {
3333
COLLECTION,
3434
}
3535

3636
public static final String VIRTUAL_BASE_ENTITY = "%VIRTUAL_BASE%";
37-
37+
public static final String EXPORT_SEARCH_RESULT = "EXPORT_SEARCH_RESULT";
3838
public static final String CREATE_ITEM = "CREATE_ITEM";
3939
public static final String EDIT_ITEM = "EDIT_ITEM";
4040
public static final String VIEW_ITEM = "VIEW_ITEM";
@@ -139,7 +139,7 @@ public static enum PrivilegeType {
139139

140140
public static final String CREATE_PFX = "CREATE_";
141141

142-
public static enum Recipient {
142+
public enum Recipient {
143143
EVERYONE("*", true),
144144
USER("U"),
145145
GROUP("G"),
@@ -153,11 +153,11 @@ public static enum Recipient {
153153
private final String prefix;
154154
private final boolean standalone;
155155

156-
private Recipient(String prefix) {
156+
Recipient(String prefix) {
157157
this(prefix, false);
158158
}
159159

160-
private Recipient(String prefix, boolean standalone) {
160+
Recipient(String prefix, boolean standalone) {
161161
this.prefix = prefix;
162162
this.standalone = standalone;
163163
}

Source/Plugins/Core/com.equella.base/src/com/tle/web/api/item/interfaces/beans/AttachmentBean.java

+9
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ public abstract class AttachmentBean extends AbstractExtendableBean {
3131
private String viewer;
3232
private boolean preview;
3333
private boolean erroredIndexing;
34+
private boolean restricted;
3435

3536
public String getUuid() {
3637
return uuid;
@@ -67,6 +68,14 @@ public void setPreview(boolean preview) {
6768
this.preview = preview;
6869
}
6970

71+
public void setRestricted(boolean restricted) {
72+
this.restricted = restricted;
73+
}
74+
75+
public boolean isRestricted() {
76+
return restricted;
77+
}
78+
7079
/**
7180
* @see com.tle.beans.item.attachments.IAttachment#isErroredIndexing
7281
* @return The value of erroredIndexing

0 commit comments

Comments
 (0)