Skip to content

Commit 2334874

Browse files
authored
Merge branch 'master' into JMante1-patch-1
2 parents 5d3fa16 + 66ae108 commit 2334874

File tree

120 files changed

+32712
-6850
lines changed

Some content is hidden

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

120 files changed

+32712
-6850
lines changed

.github/workflows/test.yml

+73-79
Original file line numberDiff line numberDiff line change
@@ -3,101 +3,95 @@ name: Integration testing
33
on: push
44

55
jobs:
6-
build:
6+
build:
77
name: Build Docker image
88
runs-on: ubuntu-latest
99
steps:
10-
- uses: actions/checkout@v2
11-
name: Checkout source tree
12-
- uses: nick-invision/retry@v1
13-
name: Build docker image
14-
with:
15-
timeout_minutes: 10
16-
max_attempts: 3
17-
command: docker build . --file docker/Dockerfile --tag synbiohub/synbiohub:snapshot-standalone
18-
- name: Package image
19-
run: |
20-
docker save synbiohub/synbiohub:snapshot-standalone | gzip > sbh.tar.gz
21-
- uses: actions/upload-artifact@v2
22-
name: Upload Docker image
23-
with:
24-
name: sbh-image
25-
path: sbh.tar.gz
10+
- uses: actions/checkout@v2
11+
name: Checkout source tree
12+
- uses: nick-invision/retry@v1
13+
name: Build docker image
14+
with:
15+
timeout_minutes: 10
16+
max_attempts: 3
17+
command: docker build . --file docker/Dockerfile --tag synbiohub/synbiohub:snapshot-standalone
18+
- name: Package image
19+
run: |
20+
docker save synbiohub/synbiohub:snapshot-standalone | gzip > sbh.tar.gz
21+
- uses: actions/upload-artifact@v4
22+
name: Upload Docker image
23+
with:
24+
name: sbh-image
25+
path: sbh.tar.gz
2626
sboltests:
2727
name: SBOL Test Suite
2828
needs: build
2929
runs-on: ubuntu-latest
3030
steps:
31-
- uses: actions/checkout@v2
32-
name: Checkout source tree
33-
- uses: actions/download-artifact@v2
34-
name: Download Docker image
35-
with:
36-
name: sbh-image
37-
- name: Import saved Docker image
38-
run: |
39-
cat sbh.tar.gz | docker load
40-
- uses: actions/setup-python@v1
41-
name: Install Python
42-
with:
43-
python-version: '3.6' # To match the one in Travis
44-
- name: Install test dependencies
45-
run: |
46-
pip install -r tests/test_requirements.txt
47-
- uses: nick-invision/retry@v1
48-
name: Run test suite
49-
with:
50-
timeout_minutes: 10
51-
max_attempts: 3
52-
command: tests/sbolsuite.sh
31+
- uses: actions/checkout@v2
32+
name: Checkout source tree
33+
- uses: actions/download-artifact@v4
34+
name: Download Docker image
35+
with:
36+
name: sbh-image
37+
- name: Import saved Docker image
38+
run: |
39+
cat sbh.tar.gz | docker load
40+
- uses: actions/setup-python@v4
41+
name: Install Python
42+
with:
43+
python-version: '3.9' # To match the one in Travis
44+
- name: Install test dependencies
45+
run: |
46+
pip install -r tests/test_requirements.txt
47+
- uses: nick-invision/retry@v1
48+
name: Run test suite
49+
with:
50+
timeout_minutes: 10
51+
max_attempts: 3
52+
command: tests/sbolsuite.sh
5353
sbhtests:
5454
name: SynBioHub Test Suite
5555
needs: build
5656
runs-on: ubuntu-latest
5757
steps:
58-
- uses: actions/checkout@v2
59-
name: Checkout source tree
60-
- uses: actions/download-artifact@v2
61-
name: Download Docker image
62-
with:
63-
name: sbh-image
64-
- name: Import saved Docker image
65-
run: |
66-
cat sbh.tar.gz | docker load
67-
- uses: actions/setup-python@v1
68-
name: Install Python
69-
with:
70-
python-version: '3.6' # To match the one in Travis
71-
- name: Install test dependencies
72-
run: |
73-
pip install -r tests/test_requirements.txt
74-
- name: Run tests
75-
run: |
76-
tests/test.sh --stopaftertestsuite
58+
- uses: actions/checkout@v2
59+
name: Checkout source tree
60+
- uses: actions/download-artifact@v4
61+
name: Download Docker image
62+
with:
63+
name: sbh-image
64+
- name: Import saved Docker image
65+
run: |
66+
cat sbh.tar.gz | docker load
67+
- uses: actions/setup-python@v4
68+
name: Install Python
69+
with:
70+
python-version: '3.9' # To match the one in Travis
71+
- name: Install test dependencies
72+
run: |
73+
pip install -r tests/test_requirements.txt
74+
- name: Run tests
75+
run: |
76+
tests/test.sh --stopaftertestsuite
7777
publish:
7878
name: Publish snapshot image
7979
needs: [sboltests, sbhtests]
8080
runs-on: ubuntu-latest
8181
if: endsWith(github.ref, 'master')
8282
steps:
83-
- uses: actions/download-artifact@v2
84-
name: Download Docker iamge
85-
with:
86-
name: sbh-image
87-
- name: Import saved Docker image
88-
run: |
89-
cat sbh.tar.gz | docker load
90-
- uses: azure/docker-login@v1
91-
name: Log into Docker Hub
92-
with:
93-
username: ${{ secrets.DOCKER_USERNAME }}
94-
password: ${{ secrets.DOCKER_PASSWORD }}
95-
- name: Push the image to Docker Hub
96-
run: |
97-
docker push synbiohub/synbiohub:snapshot-standalone
98-
- name: Trigger SD2 redeploy
99-
env:
100-
SD2_USER: ${{ secrets.SD2_USER }}
101-
SD2_TOKEN: ${{ secrets.SD2_TOKEN }}
102-
run: |
103-
curl -X POST --user $SD2_USER:$SD2_TOKEN https://jenkins.sd2e.org/job/Synbiohub/job/Redeploy%20to%20dev%20server/build
83+
- uses: actions/download-artifact@v4
84+
name: Download Docker iamge
85+
with:
86+
name: sbh-image
87+
- name: Import saved Docker image
88+
run: |
89+
cat sbh.tar.gz | docker load
90+
- uses: azure/docker-login@v1
91+
name: Log into Docker Hub
92+
with:
93+
username: ${{ secrets.DOCKER_USERNAME }}
94+
password: ${{ secrets.DOCKER_PASSWORD }}
95+
- name: Push the image to Docker Hub
96+
run: |
97+
docker push synbiohub/synbiohub:snapshot-standalone

browser/synbiohub.js

+2
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,8 @@ function createPluginFunctions(pluginType) {
220220
createPluginFunctions('submit')
221221
createPluginFunctions('rendering')
222222
createPluginFunctions('download')
223+
createPluginFunctions('curation')
224+
createPluginFunctions('authorization')
223225

224226
$('.sbh-registries-datatable').DataTable({
225227
processing: false,

config.json

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"instanceLogo": "",
66
"keywords": "synbiohub",
77
"javaPath": "java",
8+
"SBOLExplorerEndpoint": "http://localhost:13162/",
9+
"useSBOLExplorer": true,
810
"theme": "default",
911
"themeParameters": {
1012
"default": {
@@ -79,6 +81,7 @@
7981
"defaultLimit": 10,
8082
"frontPageText": "<a href=\"/About\">SynBioHub</a> is a <i>design repository</i> for people designing biological constructs. It enables DNA and protein designs to be uploaded, then provides a shareable link to allow others to view them. SynBioHub also facilitates searching for information about existing useful parts and designs by combining data from a variety of sources.",
8183
"allowPublicSignup": true,
84+
"requireLogin": false,
8285
"showModuleInteractions": false,
8386
"prewarmSearch": true,
8487
"bioschemas": {
@@ -118,6 +121,8 @@
118121
"plugins": {
119122
"rendering": [],
120123
"download": [],
121-
"submit": []
124+
"submit": [],
125+
"curation": [],
126+
"authorization": []
122127
}
123128
}

docker/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ WORKDIR /synbiohub
77
COPY . .
88

99
RUN cd java && mvn package
10+
RUN git config --global url."https://".insteadOf git://
1011
RUN yarn install
1112

1213
RUN mkdir /mnt/data && \

java/.classpath

+17
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,22 @@
3434
<attribute name="maven.pomderived" value="true"/>
3535
</attributes>
3636
</classpathentry>
37+
<classpathentry kind="src" path="target/generated-sources/annotations">
38+
<attributes>
39+
<attribute name="optional" value="true"/>
40+
<attribute name="maven.pomderived" value="true"/>
41+
<attribute name="ignore_optional_problems" value="true"/>
42+
<attribute name="m2e-apt" value="true"/>
43+
</attributes>
44+
</classpathentry>
45+
<classpathentry kind="src" output="target/test-classes" path="target/generated-test-sources/test-annotations">
46+
<attributes>
47+
<attribute name="optional" value="true"/>
48+
<attribute name="maven.pomderived" value="true"/>
49+
<attribute name="ignore_optional_problems" value="true"/>
50+
<attribute name="m2e-apt" value="true"/>
51+
<attribute name="test" value="true"/>
52+
</attributes>
53+
</classpathentry>
3754
<classpathentry kind="output" path="target/classes"/>
3855
</classpath>

java/.project

+11
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,15 @@
2020
<nature>org.eclipse.m2e.core.maven2Nature</nature>
2121
<nature>org.eclipse.jdt.core.javanature</nature>
2222
</natures>
23+
<filteredResources>
24+
<filter>
25+
<id>1666213768703</id>
26+
<name></name>
27+
<type>30</type>
28+
<matcher>
29+
<id>org.eclipse.core.resources.regexFilterMatcher</id>
30+
<arguments>node_modules|\.git|__CREATED_BY_JAVA_LANGUAGE_SERVER__</arguments>
31+
</matcher>
32+
</filter>
33+
</filteredResources>
2334
</projectDescription>

java/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
<artifactId>CombineArchive</artifactId>
5959
<version>1.4.1</version>
6060
</dependency>
61-
<dependency>
61+
<dependency>
6262
<groupId>org.sbolstandard</groupId>
6363
<artifactId>libSBOLj</artifactId>
6464
<version>2.4.1-SNAPSHOT</version>

java/src/main/java/org/synbiohub/ConvertToGenBankJob.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,7 @@ public void execute() throws Exception
2121
{
2222
ByteArrayOutputStream logOutputStream = new ByteArrayOutputStream();
2323
ByteArrayOutputStream errorOutputStream = new ByteArrayOutputStream();
24-
25-
System.err.println("GFF3="+gff3Out);
26-
24+
2725
SBOLDocument doc = SBOLValidate.validate(
2826
new PrintStream(logOutputStream),
2927
new PrintStream(errorOutputStream),
@@ -45,9 +43,11 @@ public void execute() throws Exception
4543
false,
4644
false,
4745
gff3Out,
46+
false,
4847
"",
4948
false,
5049
false,
50+
false,
5151
false);
5252

5353
String log = new String(logOutputStream.toByteArray(), StandardCharsets.UTF_8);

java/src/main/java/org/synbiohub/PrepareSubmissionJob.java

+2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public class PrepareSubmissionJob extends Job {
8787
public String tempDirPath;
8888
public boolean useSBOLExplorer;
8989
public String SBOLExplorerEndpoint;
90+
public String user;
9091

9192
private boolean readCOMBINEArchive(String initialFilename, Map<String, String> attachments) {
9293
CombineArchive combine = null;
@@ -481,6 +482,7 @@ public void visit(Identified identified, TopLevel topLevel) {
481482
// Check if the object is already in the collection
482483
for (String registry : webOfRegistries.keySet()) {
483484
SynBioHubFrontend sbh = new SynBioHubFrontend(webOfRegistries.get(registry), registry);
485+
sbh.setUser(user);
484486
if (topLevel.getIdentity().toString().startsWith(registry)) {
485487

486488
// Fetch the object from SynBioHub

lib/actions/addOwnedBy.js

+17-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,20 @@ const config = require('../config')
44
const getOwnedBy = require('../query/ownedBy')
55
const retrieveUris = require('../retrieveUris')
66
const getUrisFromReq = require('../getUrisFromReq')
7+
const db = require('../db')
78

8-
module.exports = function (req, res) {
9+
module.exports = async function (req, res) {
910
const userUri = req.body.user
1011

12+
var userId = ''
13+
if (req.body.user.lastIndexOf('/') >= 0) {
14+
userId = req.body.user.substring(req.body.user.lastIndexOf('/') + 1)
15+
}
16+
17+
const user = await db.model.User.findOne({
18+
where: db.sequelize.or({ email: userId }, { username: userId })
19+
})
20+
1121
const { graphUri, uri } = getUrisFromReq(req, res)
1222

1323
const sharedAdditionQuery = loadTemplate('./sparql/AddToSharedCollection.sparql', {
@@ -23,6 +33,12 @@ module.exports = function (req, res) {
2333
})
2434
}
2535

36+
if (!user) {
37+
return new Promise(function (resolve, reject) {
38+
reject(new Error('user ' + userId + ' not recognized'))
39+
})
40+
}
41+
2642
return sparql.updateQuery(sharedAdditionQuery, userUri).then(() => {
2743
return retrieveUris(uri, graphUri)
2844
}).then((uris) => {

lib/actions/admin/deletePlugin.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ module.exports = function (req, res) {
77

88
var plugins = config.get('plugins')
99

10-
if (!category || (category !== 'rendering' && category !== 'download' && category !== 'submit')) {
11-
return res.status(400).header('content-type', 'text/plain').send('Must provide a category with value of rendering, submit, or download')
10+
if (!category || (category !== 'rendering' && category !== 'download' && category !== 'submit' && category !== 'curation' && category !== 'authorization')) {
11+
return res.status(400).header('content-type', 'text/plain').send('Must provide a category with value of rendering, submit, curation, or download')
1212
}
1313
if (!id) {
1414
return res.status(400).header('content-type', 'text/plain').send('Must provide a valid plugin id')

lib/actions/admin/savePlugin.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ module.exports = function (req, res) {
1010

1111
var plugins = config.get('plugins')
1212

13-
if (!category || (category !== 'rendering' && category !== 'download' && category !== 'submit')) {
14-
return res.status(400).header('content-type', 'text/plain').send('Must provide a category with value of rendering, submit, or download')
13+
if (!category || (category !== 'rendering' && category !== 'download' && category !== 'submit' && category !== 'curation' && category !== 'authorization')) {
14+
return res.status(400).header('content-type', 'text/plain').send('Must provide a category with value of rendering, submit, curation, or download')
1515
}
1616
if (!name) {
1717
return res.status(400).header('content-type', 'text/plain').send('Must provide a valid plugin name')

lib/actions/makePublic.js

+5-2
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ var fs = require('mz/fs')
2626

2727
const prepareSubmission = require('../prepare-submission')
2828

29+
const apiTokens = require('../apiTokens')
30+
2931
module.exports = function (req, res) {
3032
req.setTimeout(0) // no timeout
3133

@@ -225,10 +227,11 @@ module.exports = function (req, res) {
225227
rootCollectionIdentity: config.get('databasePrefix') + 'public/' + collectionId + '/' + collectionId + '_collection' + '/' + version,
226228
newRootCollectionDisplayId: collectionId + '_collection',
227229
newRootCollectionVersion: version,
228-
ownedByURI: config.get('databasePrefix') + 'user/' + req.user.username,
230+
ownedByURI: config.get('databasePrefix') + 'user/' + req.params.userId,
229231
creatorName: '',
230232
citationPubmedIDs: citations,
231-
overwrite_merge: overwriteMerge
233+
overwrite_merge: overwriteMerge,
234+
user: apiTokens.createToken(req.user)
232235

233236
})
234237
}).then((result) => {

0 commit comments

Comments
 (0)