Skip to content

Commit 759e496

Browse files
authored
Merge pull request #45 from SciCatProject/202402-updates
202402 updates
2 parents 8b8dbdb + 2b159e2 commit 759e496

File tree

7 files changed

+177
-36
lines changed

7 files changed

+177
-36
lines changed

Diff for: Development/v4.x/backend/authorization/authorization_samples.md

+17-18
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ This is the list of the permissions methods available for Samples and all their
2727
- SampleUpdateAny
2828
- SampleDeleteOwner
2929
- SampleDeleteAny
30-
- SampleAttachmentCreateOnwer
30+
- SampleAttachmentCreateOwner
3131
- SampleAttachmentCreateAny
3232
- SampleAttachmentReadManyPublic
3333
- SampleAttachmentReadManyAccess
@@ -59,8 +59,8 @@ graph LR;
5959
SampleUpdateOwner-->SampleUpdateAny;
6060
SampleDelete-->SampleDeleteOwner;
6161
SampleDeleteOwner-->SampleDeleteAny;
62-
SampleAttachmentCreate-->SampleAttachmentCreateOnwer;
63-
SampleAttachmentCreateOnwer-->SampleAttachmentCreateAny;
62+
SampleAttachmentCreate-->SampleAttachmentCreateOwner;
63+
SampleAttachmentCreateOwner-->SampleAttachmentCreateAny;
6464
SampleAttachmentRead-->SampleAttachmentReadManyPublic;
6565
SampleAttachmentReadManyPublic-->SampleAttachmentReadManyAccess;
6666
SampleAttachmentReadManyAccess-->SampleAttachmentReadManyOwner;
@@ -76,20 +76,19 @@ graph LR;
7676
```
7777

7878
#### Authorization table
79-
| HTTP method | Endpoint | Endpoint Authentication | Anonymous | Authenticated User | Sample Groups | Admin Groups | Delete Groups | Notes |
80-
| -------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |
81-
| POST | Samples | _SampleCreate_ | __no__ | __no__ | Any<br>_SampleCreateAny_ | Any<br>_SampleCreateAny_ | __no__ | |
82-
| GET | Samples | _SampleRead_ | Public<br/>_SampleReadManyPublic_ | Has Access<br/>_SampleReadManyAccess_ | Has Access<br/>_SampleReadManyAccess_ | Any<br/>_SampleReadAny_ | __no__ | |
83-
| GET | Samples/fullquery | _SampleRead_ | Public<br/>_SampleReadManyPublic_ | Has Access<br/>_SampleReadManyAccess_ | Has Access<br/>_SampleReadManyAccess_ | Any<br/>_SampleReadAny_ | __no__ | |
84-
| GET | Samples/fullfacet | _SampleRead_ | Public<br/>_SampleReadManyPublic_ | Has Access<br/>_SampleReadManyAccess_ | Has Access<br/>_SampleReadManyAccess_ | Any<br/>_SampleReadAny_ | __no__ | |
85-
| GET | Samples/_pid_ | _SampleRead_ | Public<br/>_SampleReadOnePublic_ | Has Access<br/>_SampleReadOneAccess_ | Has Access<br/>_SampleReadOneAccess_ | Any<br/>_SampleReadAny_ | __no__ | |
86-
| GET | Samples/fullquery | _SampleRead_ | Public<br/>_SampleReadOnePublic_ | Has Access<br/>_SampleReadOneAccess_ | Has Access<br/>_SampleReadOneAccess_ | Any<br/>_SampleReadAny_ | __no__ | |
87-
| PATCH | Samples/_pid_ | _SampleUpdate_ | __no__ | __no__ | Owner<br/>_SampleUpdateOwn_ | Any<br/>_SampleUpdateAny_ | __no__ | |
88-
| DELETE | Samples/_pid_ | _SampleDelete_ | __no__ | __no__ | __no__ | __no__ | Any<br/>_SampleDeleteAny_ | |
79+
| HTTP method | Endpoint | Endpoint Authentication | Anonymous | Authenticated User | Sample Groups | Sample Privileged Groups | Admin Groups | Delete Groups | Notes |
80+
| -------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- | ------- |
81+
| POST | Samples | _SampleCreate_ | __no__ | __no__ | Owner<br>_SampleCreateOwner_ | Any<br>_SampleCreateAny_ | Any<br>_SampleCreateAny_ | __no__ | |
82+
| GET | Samples | _SampleRead_ | Public<br/>_SampleReadManyPublic_ | Has Access<br/>_SampleReadManyAccess_ | Has Access<br/>_SampleReadManyAccess_ | Has Access<br/>_SampleReadManyAccess_ | Any<br/>_SampleReadAny_ | __no__ | |
83+
| GET | Samples/fullquery | _SampleRead_ | Public<br/>_SampleReadManyPublic_ | Has Access<br/>_SampleReadManyAccess_ | Has Access<br/>_SampleReadManyAccess_ | Has Access<br/>_SampleReadManyAccess_ | Any<br/>_SampleReadAny_ | __no__ | |
84+
| GET | Samples/fullfacet | _SampleRead_ | Public<br/>_SampleReadManyPublic_ | Has Access<br/>_SampleReadManyAccess_ | Has Access<br/>_SampleReadManyAccess_ | Has Access<br/>_SampleReadManyAccess_ | Any<br/>_SampleReadAny_ | __no__ | |
85+
| GET | Samples/_pid_ | _SampleRead_ | Public<br/>_SampleReadOnePublic_ | Has Access<br/>_SampleReadOneAccess_ | Has Access<br/>_SampleReadOneAccess_ | Has Access<br/>_SampleReadOneAccess_ | Any<br/>_SampleReadAny_ | __no__ | |
86+
| GET | Samples/fullquery | _SampleRead_ | Public<br/>_SampleReadOnePublic_ | Has Access<br/>_SampleReadOneAccess_ | Has Access<br/>_SampleReadOneAccess_ | Has Access<br/>_SampleReadOneAccess_ | Any<br/>_SampleReadAny_ | __no__ | |
87+
| PATCH | Samples/_pid_ | _SampleUpdate_ | __no__ | __no__ | Owner<br/>_SampleUpdateOwn_ | Owner<br/>_SampleUpdateOwn_ | Any<br/>_SampleUpdateAny_ | __no__ | |
88+
| DELETE | Samples/_pid_ | _SampleDelete_ | __no__ | __no__ | __no__ | __no__ | __no__ | Any<br/>_SampleDeleteAny_ | |
8989
|||||
90-
| POST | Samples/_pid_/attachements | _SampleAttachementCreate_ | __no__ | __no__ | Any<br>_SampleAttachmentCreateAny_ | Any<br>_SampleAttachmentCreateAny_ | __no__ | |
91-
| GET | Samples/_pid_/attachements | _SampleAttachmentRead_ | Public<br/>_SampleAttachmentReadManyPublic_ | Has Access<br/>_SampleAttachmentReadManyAccess_ | Has Access<br/>_SampleAttachmentReadManyAccess_ | Any<br/>_SampleAttachmentReadManyAny_ | __no__ | |
92-
| PATCH | Samples/_pid_/attachments/_aid_ | _SampleAttachmentUpdate_ | __no__ | __no__ | Owner<br/>_SampleAttachmentUpdateOwner_ | Any<br/>_SampleAttachmentUpdateAny_ | __no__ | |
93-
| DELETE | Samples/_pid_/attachment/_aid_ | _SampleAttachmentDelete_ | __no__ | __no__ | Onwer<br/>_SampleAttachmentDeleteOwner_ | Any<br/>_SampleAttachmentDeleteAny_ | __no__ | |
90+
| POST | Samples/_pid_/Attachments | _SampleAttachmentCreate_ | __no__ | __no__ | Owner<br>_SampleAttachmentCreateOwner_ | Any<br>_SampleAttachmentCreateAny_ | Any<br>_SampleAttachmentCreateAny_ | __no__ | |
91+
| GET | Samples/_pid_/Attachments | _SampleAttachmentRead_ | Public<br/>_SampleAttachmentReadManyPublic_ | Has Access<br/>_SampleAttachmentReadManyAccess_ | Has Access<br/>_SampleAttachmentReadManyAccess_ | Has Access<br/>_SampleAttachmentReadManyAccess_ | Any<br/>_SampleAttachmentReadManyAny_ | __no__ | |
92+
| DELETE | Samples/_pid_/attachment/_aid_ | _SampleAttachmentDelete_ | __no__ | __no__ | Owner<br/>_SampleAttachmentDeleteOwner_ | Owner<br/>_SampleAttachmentDeleteOwner_ | Any<br/>_SampleAttachmentDeleteAny_ | Any<br/>_SampleAttachmentDeleteAny_ | |
9493
|||||
95-
| GET | Samples/_pid_/datasets | _SampleDatasetRead_ | Public<br/>_SampleDatasetReadOnePublic_ | Has Access<br/>_SampleDatasetReadOneAccess_ | Has Access<br/>_SampleDatasetReadOneAccess_ | Any<br/>_SampleDatasetReadOneAny_ | __no__ | |
94+
| GET | Samples/_pid_/datasets | _SampleDatasetRead_ | Public<br/>_SampleDatasetReadOnePublic_ | Has Access<br/>_SampleDatasetReadOneAccess_ | Has Access<br/>_SampleDatasetReadOneAccess_ | Has Access<br/>_SampleDatasetReadOneAccess_ | Any<br/>_SampleDatasetReadOneAny_ | __no__ | |

Diff for: Development/v4.x/backend/configuration.md

+16
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,22 @@ The list is compiled according to the configuration class defined in _src/config
3737
_default_: ""
3838
_format_: comma separated list of strings. Leading and trailing spaces are trimmed
3939

40+
- PROPOSAL\_GROUPS:
41+
list of non admin groups that are allowed to create and update proposals for groups they do not belong to. If set to "#all", all users can create a dataset belonging to any group with explicit pid.
42+
_default_: ""
43+
_format_: comma separated list of strings. Leading and trailing spaces are trimmed
44+
45+
- SAMPLE\_GROUPS:
46+
list of non admin groups that are allowed to create and update samples for the groups they belong to. If set to "#all", all users can create a dataset belonging to their group.
47+
_default_: ""
48+
_format_: comma separated list of strings. Leading and trailing spaces are trimmed
49+
50+
- SAMPLE\_PRIVILEGED\_GROUPS:
51+
list of non admin groups that are allowed to create samples for any groups, but can only update samples belonging to groups they belong to.
52+
_default_: ""
53+
_format_: comma separated list of strings. Leading and trailing spaces are trimmed
54+
55+
4056
- ACCESS\_GROUPS\_STATIC\_VALUES:
4157
List of groups assigned by default to all users. Used in the vanilla implementation for easy configuration.
4258
If you do not want or need to assign any default group, it should be set to empty string "".
+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# 0300: Dataset Authorization
2+
3+
Dataset Authorization tests that authorization is correctly set for all the dataset endpoints for all the different type of users.
4+
5+
| Test Number | HTTP Method | Endpoint | Authenticated User | Expected Request Status | Input | Results |
6+
| ----- | ----- | ----- | ----- | ----- | ----- | ----- |
7+
| 0010 | POST | Datasets | ingestor | 200 | ```test public dataset 1``` | ```test dataset 1 with scicat pid``` |
8+
| 0020 | POST | Datasets | ingestor | 200 | ```test private dataset 2``` | ```test dataset 2 with scicat pid``` |
9+
| 0030 | POST | Datasets | ingestor | 200 | ```test private dataset 3``` | ```test dataset 3 with scicat pid``` |
10+
| 0040 | POST | Datasets/_PidDataset1_/origdatablocks | ingestor | 201 | ```TestData.OrigDatablockCorrect1``` | ```OrigDatablock 1 with SciCat id``` |
11+
| 0050 | POST | Datasets/_PidDataset1_/datablocks | ingestor | 201 | ```TestData.DatablockCorrect1``` | ```Datablock 1 with SciCat id``` |
12+
| 0060 | POST | Datasets/_PidDataset1_/attachements | ingestor | 201 | ```TestData.AttachementCorrect``` | ```Attachment 1 with SciCat id``` |
13+
| 0070 | GET | Datasets | _anonymous_ | 200 | n/a | ```dataset 1``` |
14+
| 0080 | GET | Datasets/_PidDataset1_ | _anonymous_ | 200 | n/a | ```dataset 1``` |
15+
| 0090 | GET | Datasets/_PidDataset2_ | _anonymous_ | 403 | n/a | ```Error 403, not authorized``` |
16+
| 0100 | GET | Datasets | ingestor | 200 | n/a | ```datasets 1,2,3``` |
17+
| 0110 | GET | Datasets/count | ingestor | 200 | n/a | ```{ count: 3 }``` |
18+
| 0120 | GET | Datasets/_PidDataset1_ | ingestor | 200 | n/a | ```dataset 1``` |
19+
| 0130 | GET | Datasets/fullquery | ingestor | 200 | n/a | ```dataset 1,2,3``` |
20+
| 0140 | GET | Datasets/_PidDataset2_ | ingestor | 200 | n/a | ```dataset 2``` |
21+
| 0150 | GET | Datasets/_PidDataset3_ | ingestor | 200 | n/a | ```dataset 3``` |
22+
| 0160 | GET | Datasets | user1 | 200 | n/a | ```dataset 1, 2``` |
23+
| 0170 | GET | Datasets/count | user1 | 200 | n/a | ```{ count: 2 }``` |
24+
| 0180 | GET | Datasets/_PidDataset1_ | user1 | 200 | n/a | ```dataset 1``` |
25+
| 0190 | GET | Datasets/_PidDataset2_ | user1 | 200 | n/a | ```dataset 2``` |
26+
| 0200 | GET | Datasets/_PidDataset3_ | user1 | 200 | n/a | ```Error 403``` |
27+
| 0210 | GET | Datasets/fullquery | user1 | 200 | n/a | ```dataset 1,2``` |
28+
| 0220 | GET | Datasets | user2 | 200 | n/a | ```dataset 1,3``` |
29+
| 0230 | GET | Datasets/count | user2 | 200 | n/a | ```{ count: 2 }``` |
30+
| 0240 | GET | Datasets/_PidDataset1_ | user2 | 200 | n/a | ```dataset 1``` |
31+
| 0250 | GET | Datasets/_PidDataset2_ | user2 | 403 | n/a | ```Error 403, not authorized``` |
32+
| 0260 | GET | Datasets/_PidDataset3_ | user2 | 200 | n/a | ```dataset 3``` |
33+
| 0270 | GET | Datasets/fullquery | user2 | 200 | n/a | ```dataset 1,3``` |
34+
| 0280 | GET | Datasets | user3 | 200 | n/a | ```dataset 1,2,3``` |
35+
| 0290 | GET | Datasets/count | user3 | 200 | n/a | ```{ count: 3 }``` |
36+
| 0300 | GET | Datasets/_PidDataset1_ | user3 | 200 | n/a | ```dataset 1``` |
37+
| 0310 | GET | Datasets/_PidDataset2_ | user3 | 200 | n/a | ```dataset 2``` |
38+
| 0320 | GET | Datasets/_PidDataset3_ | user3 | 200 | n/a | ```dataset 3``` |
39+
| 0330 | GET | Datasets/fullquery | user3 | 200 | n/a | ```dataset 1,2,3``` |
40+
| 0340 | POST | Datasets/_PidDataset2_ | ingestor | 200 | ```{ isPublished: true }``` | ```public dataset 2``` |
41+
| 0350 | GET | Datasets/fullquery | user2 | 200 | ```{ fields: { isPublished: true}}``` | ```dataset 1,2``` |
42+
| 0360 | GET | Datasets/fullfacet | user2 | 200 | ```{ fields: { isPublished: true}}``` | ```{ totalSets: 2 }``` |
43+
| 0370 | GET | Datasets/_PidDataset1_/origdatablocks | user3 | 200 | n/a | ```1 origdatablock dataset 1``` |
44+
| 0380 | GET | Datasets/_PidDataset1_/datablocks | user3 | 200 | n/a | ```1 datablock dataset 1``` |
45+
| 0390 | GET | Datasets/_PidDataset1_/attachments | user3 | 200 | n/a | ```1 attachment dataset 1``` |
46+
| 0400 | GET | Datasets/_PidDataset1_/thumbnail | user3 | 200 | n/a | ```thumbnail dataset 1``` |
47+
| 0410 | DELETE | Datasets/_PidDataset1_/attachment | archiveManager | 200 | n/a | n/a |
48+
| 0420 | DELETE | Datasets/_PidDataset1_/origdatablock | archiveManager | 200 | n/a | n/a |
49+
| 0430 | DELETE | Datasets/_PidDataset3_/datablock | archiveManager | 200 | n/a | n/a |
50+
| 0440 | DELETE | Datasets/_PidDataset1_ | archiveManager | 200 | n/a | n/a |
51+
| 0450 | DELETE | Datasets/_PidDataset2_ | archiveManager | 200 | n/a | n/a |
52+
| 0460 | DELETE | Datasets/_PidDataset3_ | archiveManager | 200 | n/a | n/a |
53+

Diff for: Development/v4.x/backend/testing/dataset_types.md

+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# 0200: Dataset Types
2+
3+
Dataset types tests that over all functionalities regarding creating, updating, deleting and retrieving datasets both raw and derived.
4+
They are the original datasets tests. _In the near future, they should be reviewed and updated or removed_.
5+
6+
| Test Number | HTTP Method | Endpoint | Authenticated User | Expected Request Status | Input | Results |
7+
| ----- | ----- | ----- | ----- | ----- | ----- | ----- |
8+
| 0010 | GET | Datasets/count | admin | 201 | n/a | ```{ count: 0 }``` |
9+
| 0020 | GET | Datasets/count | admin | 201 | ```{ "type" : "raw" }``` | ```{ count: 0 }``` |
10+
| 0030 | GET | Datasets/count | admin | 201 | ```{ "type" : "derived" }``` | ```{ count: 0 }``` |
11+
| ---- |
12+
| 0040 | POST | Instruments | ingestor | 400 | ```TestData.InstrumentCorrect2``` | ```Error: duplicate entry``` |
13+
| 0050 | POST | Instruments | ingestor | 400 | ```TestData.InstrumentWrong1``` | ```Validation Error``` |
14+
| 0060 | POST | Instruments | user1 | 400 | ```TestData.InstrumentCorrect2``` | ```Unauthorized``` |
15+
| 0070 | GET | Instruments/_instrumentId1_ | ingestor | 200 | n/a | ```TestData.InstrumentCorrect1``` |
16+
| 0080 | GET | Instruments/_instrumentId2_ | ingestor | 200 | n/a | ```TestData.InstrumentCorrect2``` |
17+
| 0090 | GET | Instruments | ingestor | 200 | n/a | ```TestData.InstrumentCorrect 1,2,3``` |
18+
| 0100 | GET | Instruments | ingestor | 200 | ```{where: {customMetadata: { main_user: "ESS"}}}``` | ```TestData.InstrumentCorrect 1,2``` |
19+
| 0110 | GET | Instruments/findOne | ingestor | 200 | n/a | ```TestData.InstrumentCorrect1``` |
20+
| 0120 | GET | Instruments/findOne | ingestor | 200 | ```{where: {customMetadata: { main_user: "ESS"}}}``` | ```TestData.InstrumentCorrect 1``` |
21+
| 0130 | GET | Instruments/findOne | ingestor | 200 | ```{where: {customMetadata: { main_user: { like : "somebody"}}}}``` | ```TestData.InstrumentCorrect 3``` |
22+
| 0140 | GET | Instruments | user1 | 200 | n/a | ```TestData.InstrumentCorrect 1,2,3``` |
23+
| 0150 | PATCH | Instruments/_instrumentId2_ | ingestor | 200 | ```{ name: newName }``` | ```TestData.InstrumentCorrect2 with name as newName``` |
24+
| 0160 | GET | Instruments/_instrumentId2_ | ingestor | 200 | n/a | ```TestData.InstrumentCorrect2 with name as newName``` |
25+
| 0170 | GET | Instruments/ | ingestor | 200 | ```{where: {name: "newName"}}``` | ```TestData.InstrumentCorrect2 with name as newName``` |
26+
| 0180 | DELETE | Instruments/_instrumentId1_ | ingestor | 400 | n/a | n/a |
27+
| 0190 | DELETE | Instruments/_instrumentId1_ | archiveManager | 200 | n/a | n/a |
28+
| 0200 | DELETE | Instruments/_instrumentId2_ | archiveManager | 200 | n/a | n/a |
29+
| 0210 | DELETE | Instruments/_instrumentId3_ | archiveManager | 200 | n/a | n/a |
30+
| 0220 | DELETE | Instruments/_instrumentId3_ | archiveManager | 200 | n/a | n/a |
31+
| 0230 | DELETE | Instruments/_instrumentId3_ | archiveManager | 200 | n/a | n/a |
32+
| 0240 | DELETE | Instruments/_instrumentId3_ | archiveManager | 200 | n/a | n/a |
33+
| 0250 | DELETE | Instruments/_instrumentId3_ | archiveManager | 200 | n/a | n/a |
34+
| 0260 | DELETE | Instruments/_instrumentId3_ | archiveManager | 200 | n/a | n/a |
35+
| 0270 | DELETE | Instruments/_instrumentId3_ | archiveManager | 200 | n/a | n/a |
36+
| 0280 | DELETE | Instruments/_instrumentId3_ | archiveManager | 200 | n/a | n/a |
37+
38+
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Sample Authorization
2+
3+
Dataset Authorization tests that authorization is correctly set for all the dataset endpoints for all the different type of users.
4+
5+
Tests are built around assuming the following owner, access and public information:
6+
7+
Groups | Sample 1 | Sample 2 | Sample 3 | Sample 4 | Sample 5 | Sample 6 | Sample 7 |Sample 8 | Sample 9 | Sample 10 |
8+
--- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |
9+
adminingestor | Owner | Admin | Admin | Admin | Owner | Admin | Admin | Admin | Admin | Admin |
10+
sampleingestor | | Owner | | | | Owner | | | | Public |
11+
group1 | | | Owner | | | Access | Owner | | Owner | Public |
12+
group2 | | | | Owner | Access | | Access | Owner | | Public |
13+
group3 | | Access | Access | | | | Access | | | Public |
14+
group4 | | | | Access | | Access | | | | Public |
15+
group5(_1) | Access | | | | Access | | | | Access | Public |
16+
nogroup | | | | | | | | | | Owner |
17+
18+
Users are contained in file functionalAccount.json.test and are the following:
19+
20+
User | Group | Permission Group |
21+
--- | --- | --- |
22+
adminIngestor | adminingestor | Admin Groups |
23+
sampleIngestor | sampleIngestor | Samples Privileged Groups |
24+
user1 | group1 | Samples Group |
25+
user2 | group2 | _none_ |
26+
user3 | group3 | _none_ |
27+
user4 | group4 | _none_ |
28+
user5(_1) | group5 | _none_ |
29+
30+
Dataset 10 is _public_, meaning its field _isPublished_ is set to _True_.
31+

0 commit comments

Comments
 (0)