Skip to content

Commit

Permalink
Require organisation id in Annotation upload. (#1155)
Browse files Browse the repository at this point in the history
* Require orga id in Annotation constructor.

* Update changelog

* Add organization_id to two tests.

* Set org_id on upload and update cassettes.

* Update changelog.
  • Loading branch information
markbader authored Jan 20, 2025
1 parent 2e525ab commit b5a1d2c
Show file tree
Hide file tree
Showing 33 changed files with 1,934 additions and 3,780 deletions.
1 change: 1 addition & 0 deletions webknossos/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ For upgrade instructions, please check the respective _Breaking Changes_ section
- `RemoteDataset.display_name` is deprecated. To change the name of a dataset use the `name` property instead.
- `Dataset.get_remote_datasets()` returns a mapping. The keys of this mapping changed from datasets name to datasets id.
- `Task.create()` needs a `dataset_id` now instead of a `dataset_name`. Alternativly a `RemoteDataset` object can be used. The `dataset_name` is marked as deprecated. As `dataset_name` is an optional argument now its position has changed, this is important if `create()` is called only with positional arguments.
- When uploading an Annotation the organization_id is neccessary now. The organization_id might be stored in the Annotation object or it is inferred from the current webknossos_context. [#1155](https://github.com/scalableminds/webknossos-libs/pull/1155)

### Added
- `Dataset` method `get_remote_datasets()` accepts `name` and `folder_id` as arguments now to filter remote datasets.
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ http_interactions:
- request:
method: GET
path: >-
/api/v9/annotations/570ba0092a7c0e980056fe9b/info?timestamp=1736433032000
/api/v9/annotations/570ba0092a7c0e980056fe9b/info?timestamp=1737379983000
headers:
host: localhost:9000
accept: '*/*'
accept-encoding: gzip, deflate, zstd
accept-encoding: gzip, deflate
connection: keep-alive
user-agent: python-httpx/0.27.2
x-auth-token: >-
Expand All @@ -22,7 +22,7 @@ http_interactions:
cache-control: no-cache
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
x-permitted-cross-domain-policies: master-only
date: Thu, 09 Jan 2025 14:30:32 GMT
date: Mon, 20 Jan 2025 13:33:02 GMT
content-type: application/json
content-length: '1929'
body:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ http_interactions:
headers:
host: localhost:9000
accept: '*/*'
accept-encoding: gzip, deflate, zstd
accept-encoding: gzip, deflate
connection: keep-alive
user-agent: python-httpx/0.27.2
x-auth-token: >-
Expand All @@ -22,7 +22,7 @@ http_interactions:
access-control-max-age: '600'
access-control-allow-origin: '*'
x-permitted-cross-domain-policies: master-only
date: Thu, 09 Jan 2025 14:30:33 GMT
date: Mon, 20 Jan 2025 13:33:03 GMT
content-type: application/json
content-length: '415'
body:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ http_interactions:
headers:
host: localhost:9000
accept: '*/*'
accept-encoding: gzip, deflate, zstd
accept-encoding: gzip, deflate
connection: keep-alive
user-agent: python-httpx/0.27.2
x-auth-token: >-
Expand All @@ -21,21 +21,21 @@ http_interactions:
cache-control: no-cache
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
x-permitted-cross-domain-policies: master-only
date: Thu, 09 Jan 2025 14:30:33 GMT
date: Mon, 20 Jan 2025 13:33:03 GMT
content-type: application/json
content-length: '682'
body:
encoding: utf8
data: >-
{"id":"570b9f4d2a7c0e4d008da6ef","email":"[email protected]","firstName":"user_A","lastName":"last_A","isAdmin":true,"isOrganizationOwner":true,"isDatasetManager":true,"isActive":true,"teams":[{"id":"570b9f4b2a7c0e3b008da6ec","name":"team_X1","isTeamManager":true},{"id":"59882b370d889b84020efd3f","name":"team_X3","isTeamManager":false},{"id":"59882b370d889b84020efd6f","name":"team_X4","isTeamManager":true}],"experiences":{"abc":5},"lastActivity":1736432857848,"isAnonymous":false,"isEditable":true,"organization":"Organization_X","novelUserExperienceInfos":{},"selectedTheme":"auto","created":1460379469000,"lastTaskTypeId":null,"isSuperUser":true,"isEmailVerified":true}
{"id":"570b9f4d2a7c0e4d008da6ef","email":"[email protected]","firstName":"user_A","lastName":"last_A","isAdmin":true,"isOrganizationOwner":true,"isDatasetManager":true,"isActive":true,"teams":[{"id":"570b9f4b2a7c0e3b008da6ec","name":"team_X1","isTeamManager":true},{"id":"59882b370d889b84020efd3f","name":"team_X3","isTeamManager":false},{"id":"59882b370d889b84020efd6f","name":"team_X4","isTeamManager":true}],"experiences":{"abc":5},"lastActivity":1737379785764,"isAnonymous":false,"isEditable":true,"organization":"Organization_X","novelUserExperienceInfos":{},"selectedTheme":"auto","created":1460379469000,"lastTaskTypeId":null,"isSuperUser":true,"isEmailVerified":true}
compression: none
- request:
method: GET
path: /api/v9/users/570b9f4d2a7c0e4d008da6ef/loggedTime
headers:
host: localhost:9000
accept: '*/*'
accept-encoding: gzip, deflate, zstd
accept-encoding: gzip, deflate
connection: keep-alive
user-agent: python-httpx/0.27.2
x-auth-token: >-
Expand All @@ -51,7 +51,7 @@ http_interactions:
cache-control: no-cache
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
x-permitted-cross-domain-policies: master-only
date: Thu, 09 Jan 2025 14:30:33 GMT
date: Mon, 20 Jan 2025 13:33:03 GMT
content-type: application/json
content-length: '691'
body:
Expand Down
10 changes: 5 additions & 5 deletions webknossos/tests/cassettes/test_api_client/test_dataset_info.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ http_interactions:
headers:
host: localhost:9000
accept: '*/*'
accept-encoding: gzip, deflate, zstd
accept-encoding: gzip, deflate
connection: keep-alive
user-agent: python-httpx/0.27.2
x-auth-token: >-
Expand All @@ -21,7 +21,7 @@ http_interactions:
cache-control: no-cache
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
x-permitted-cross-domain-policies: master-only
date: Thu, 09 Jan 2025 14:30:33 GMT
date: Mon, 20 Jan 2025 13:33:03 GMT
content-type: application/json
content-length: '112'
body:
Expand All @@ -35,7 +35,7 @@ http_interactions:
headers:
host: localhost:9000
accept: '*/*'
accept-encoding: gzip, deflate, zstd
accept-encoding: gzip, deflate
connection: keep-alive
user-agent: python-httpx/0.27.2
x-auth-token: >-
Expand All @@ -51,11 +51,11 @@ http_interactions:
cache-control: no-cache
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
x-permitted-cross-domain-policies: master-only
date: Thu, 09 Jan 2025 14:30:33 GMT
date: Mon, 20 Jan 2025 13:33:03 GMT
content-type: application/json
content-length: '1503'
body:
encoding: utf8
data: >-
{"id":"59e9cfbdba632ac2ab8b23b5","name":"l4_sample","dataSource":{"id":{"name":"l4_sample","team":"Organization_X"},"dataLayers":[{"name":"color","category":"color","boundingBox":{"topLeft":[3072,3072,512],"width":1024,"height":1024,"depth":1024},"resolutions":[[1,1,1],[2,2,1],[4,4,1],[8,8,2],[16,16,4]],"elementClass":"uint8","defaultViewConfiguration":{"color":[255,0,0]}},{"name":"segmentation","category":"segmentation","boundingBox":{"topLeft":[3072,3072,512],"width":1024,"height":1024,"depth":1024},"resolutions":[[1,1,1],[2,2,1],[4,4,1],[8,8,2],[16,16,4]],"elementClass":"uint32","largestSegmentId":2504697}],"scale":{"factor":[11.239999771118164,11.239999771118164,28],"unit":"nanometer"}},"dataStore":{"name":"localhost","url":"http://localhost:9000","isScratch":false,"allowsUpload":true,"jobsSupportedByAvailableWorkers":[],"jobsEnabled":false},"owningOrganization":"Organization_X","allowedTeams":[{"id":"570b9f4b2a7c0e3b008da6ec","name":"team_X1","organization":"Organization_X"}],"allowedTeamsCumulative":[{"id":"570b9f4b2a7c0e3b008da6ec","name":"team_X1","organization":"Organization_X"}],"isActive":true,"isPublic":true,"description":null,"directoryName":"l4_sample","created":1508495293789,"isEditable":true,"lastUsedByUser":1736433034081,"logoUrl":"/assets/images/mpi-logos.svg","sortingKey":1508495293789,"metadata":[{"key":"key","type":"string","value":"value"}],"isUnreported":false,"tags":[],"folderId":"570b9f4e4bb848d0885ea917","publication":null,"usedStorageBytes":1692207513}
{"id":"59e9cfbdba632ac2ab8b23b5","name":"l4_sample","dataSource":{"id":{"name":"l4_sample","team":"Organization_X"},"dataLayers":[{"name":"color","category":"color","boundingBox":{"topLeft":[3072,3072,512],"width":1024,"height":1024,"depth":1024},"resolutions":[[1,1,1],[2,2,1],[4,4,1],[8,8,2],[16,16,4]],"elementClass":"uint8","defaultViewConfiguration":{"color":[255,0,0]}},{"name":"segmentation","category":"segmentation","boundingBox":{"topLeft":[3072,3072,512],"width":1024,"height":1024,"depth":1024},"resolutions":[[1,1,1],[2,2,1],[4,4,1],[8,8,2],[16,16,4]],"elementClass":"uint32","largestSegmentId":2504697}],"scale":{"factor":[11.239999771118164,11.239999771118164,28],"unit":"nanometer"}},"dataStore":{"name":"localhost","url":"http://localhost:9000","isScratch":false,"allowsUpload":true,"jobsSupportedByAvailableWorkers":[],"jobsEnabled":false},"owningOrganization":"Organization_X","allowedTeams":[{"id":"570b9f4b2a7c0e3b008da6ec","name":"team_X1","organization":"Organization_X"}],"allowedTeamsCumulative":[{"id":"570b9f4b2a7c0e3b008da6ec","name":"team_X1","organization":"Organization_X"}],"isActive":true,"isPublic":true,"description":null,"directoryName":"l4_sample","created":1508495293789,"isEditable":true,"lastUsedByUser":1737379984239,"logoUrl":"/assets/images/mpi-logos.svg","sortingKey":1508495293789,"metadata":[{"key":"key","type":"string","value":"value"}],"isUnreported":false,"tags":[],"folderId":"570b9f4e4bb848d0885ea917","publication":null,"usedStorageBytes":1692207513}
compression: none
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ http_interactions:
headers:
host: localhost:9000
accept: '*/*'
accept-encoding: gzip, deflate, zstd
accept-encoding: gzip, deflate
connection: keep-alive
user-agent: python-httpx/0.27.2
x-auth-token: >-
Expand All @@ -21,7 +21,7 @@ http_interactions:
cache-control: no-cache
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
x-permitted-cross-domain-policies: master-only
date: Thu, 09 Jan 2025 14:30:32 GMT
date: Mon, 20 Jan 2025 13:33:02 GMT
content-type: application/json
content-length: '147'
body:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ http_interactions:
host: localhost:9000
content-length: '0'
accept: '*/*'
accept-encoding: gzip, deflate, zstd
accept-encoding: gzip, deflate
connection: keep-alive
user-agent: python-httpx/0.27.2
x-auth-token: >-
Expand All @@ -22,10 +22,10 @@ http_interactions:
cache-control: no-cache
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
x-permitted-cross-domain-policies: master-only
date: Thu, 09 Jan 2025 14:30:33 GMT
date: Mon, 20 Jan 2025 13:33:03 GMT
content-type: application/json
content-length: '34'
body:
encoding: utf8
data: '{"token":"NEdSmVtaQai_RdfG3fDxNQ"}'
data: '{"token":"PxDd6hXgE0biL9iVj3wTJQ"}'
compression: none
4 changes: 2 additions & 2 deletions webknossos/tests/cassettes/test_api_client/test_health.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ http_interactions:
headers:
host: localhost:9000
accept: '*/*'
accept-encoding: gzip, deflate, zstd
accept-encoding: gzip, deflate
connection: keep-alive
user-agent: python-httpx/0.27.2
x-auth-token: >-
Expand All @@ -21,7 +21,7 @@ http_interactions:
cache-control: no-cache
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
x-permitted-cross-domain-policies: master-only
date: Thu, 09 Jan 2025 14:30:32 GMT
date: Mon, 20 Jan 2025 13:33:02 GMT
content-type: text/plain; charset=UTF-8
content-length: '2'
body:
Expand Down
6 changes: 3 additions & 3 deletions webknossos/tests/cassettes/test_api_client/test_user_list.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ http_interactions:
headers:
host: localhost:9000
accept: '*/*'
accept-encoding: gzip, deflate, zstd
accept-encoding: gzip, deflate
connection: keep-alive
user-agent: python-httpx/0.27.2
x-auth-token: >-
Expand All @@ -21,11 +21,11 @@ http_interactions:
cache-control: no-cache
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
x-permitted-cross-domain-policies: master-only
date: Thu, 09 Jan 2025 14:30:33 GMT
date: Mon, 20 Jan 2025 13:33:03 GMT
content-type: application/json
content-length: '2287'
body:
encoding: utf8
data: >-
[{"id":"570b9f4d2a7c0e4d008da6ef","email":"[email protected]","firstName":"user_A","lastName":"last_A","isAdmin":true,"isOrganizationOwner":true,"isDatasetManager":true,"isActive":true,"teams":[{"id":"570b9f4b2a7c0e3b008da6ec","name":"team_X1","isTeamManager":true},{"id":"59882b370d889b84020efd3f","name":"team_X3","isTeamManager":false},{"id":"59882b370d889b84020efd6f","name":"team_X4","isTeamManager":true}],"experiences":{"abc":5},"lastActivity":1736433033668,"isAnonymous":false,"isEditable":true,"organization":"Organization_X","novelUserExperienceInfos":{},"selectedTheme":"auto","created":1460379469000,"lastTaskTypeId":null,"isSuperUser":true,"isEmailVerified":true},{"id":"670b9f4d2a7c0e4d008da6ef","email":"[email protected]","firstName":"user_B","lastName":"last_B","isAdmin":false,"isOrganizationOwner":false,"isDatasetManager":true,"isActive":true,"teams":[{"id":"570b9f4b2a7c0e3b008da6ec","name":"team_X1","isTeamManager":true}],"experiences":{},"lastActivity":1460465869053,"isAnonymous":false,"isEditable":true,"organization":"Organization_X","novelUserExperienceInfos":{},"selectedTheme":"auto","created":1460379469000,"lastTaskTypeId":null,"isSuperUser":true,"isEmailVerified":true},{"id":"770b9f4d2a7c0e4d008da6ef","email":"[email protected]","firstName":"user_C","lastName":"last_C","isAdmin":false,"isOrganizationOwner":false,"isDatasetManager":false,"isActive":true,"teams":[{"id":"570b9f4b2a7c0e3b008da6ec","name":"team_X1","isTeamManager":false}],"experiences":{},"lastActivity":1460552269053,"isAnonymous":false,"isEditable":true,"organization":"Organization_X","novelUserExperienceInfos":{},"selectedTheme":"auto","created":1460379469000,"lastTaskTypeId":null,"isSuperUser":true,"isEmailVerified":true},{"id":"870b9f4d2a7c0e4d008da6ef","email":"[email protected]","firstName":"user_D","lastName":"last_D","isAdmin":false,"isOrganizationOwner":false,"isDatasetManager":false,"isActive":true,"teams":[{"id":"69882b370d889b84020efd4f","name":"team_X2","isTeamManager":true}],"experiences":{},"lastActivity":1460638669053,"isAnonymous":false,"isEditable":true,"organization":"Organization_X","novelUserExperienceInfos":{},"selectedTheme":"light","created":1460379469000,"lastTaskTypeId":null,"isSuperUser":true,"isEmailVerified":true}]
[{"id":"570b9f4d2a7c0e4d008da6ef","email":"[email protected]","firstName":"user_A","lastName":"last_A","isAdmin":true,"isOrganizationOwner":true,"isDatasetManager":true,"isActive":true,"teams":[{"id":"570b9f4b2a7c0e3b008da6ec","name":"team_X1","isTeamManager":true},{"id":"59882b370d889b84020efd3f","name":"team_X3","isTeamManager":false},{"id":"59882b370d889b84020efd6f","name":"team_X4","isTeamManager":true}],"experiences":{"abc":5},"lastActivity":1737379983852,"isAnonymous":false,"isEditable":true,"organization":"Organization_X","novelUserExperienceInfos":{},"selectedTheme":"auto","created":1460379469000,"lastTaskTypeId":null,"isSuperUser":true,"isEmailVerified":true},{"id":"670b9f4d2a7c0e4d008da6ef","email":"[email protected]","firstName":"user_B","lastName":"last_B","isAdmin":false,"isOrganizationOwner":false,"isDatasetManager":true,"isActive":true,"teams":[{"id":"570b9f4b2a7c0e3b008da6ec","name":"team_X1","isTeamManager":true}],"experiences":{},"lastActivity":1460465869053,"isAnonymous":false,"isEditable":true,"organization":"Organization_X","novelUserExperienceInfos":{},"selectedTheme":"auto","created":1460379469000,"lastTaskTypeId":null,"isSuperUser":true,"isEmailVerified":true},{"id":"770b9f4d2a7c0e4d008da6ef","email":"[email protected]","firstName":"user_C","lastName":"last_C","isAdmin":false,"isOrganizationOwner":false,"isDatasetManager":false,"isActive":true,"teams":[{"id":"570b9f4b2a7c0e3b008da6ec","name":"team_X1","isTeamManager":false}],"experiences":{},"lastActivity":1460552269053,"isAnonymous":false,"isEditable":true,"organization":"Organization_X","novelUserExperienceInfos":{},"selectedTheme":"auto","created":1460379469000,"lastTaskTypeId":null,"isSuperUser":true,"isEmailVerified":true},{"id":"870b9f4d2a7c0e4d008da6ef","email":"[email protected]","firstName":"user_D","lastName":"last_D","isAdmin":false,"isOrganizationOwner":false,"isDatasetManager":false,"isActive":true,"teams":[{"id":"69882b370d889b84020efd4f","name":"team_X2","isTeamManager":true}],"experiences":{},"lastActivity":1460638669053,"isAnonymous":false,"isEditable":true,"organization":"Organization_X","novelUserExperienceInfos":{},"selectedTheme":"light","created":1460379469000,"lastTaskTypeId":null,"isSuperUser":true,"isEmailVerified":true}]
compression: none
Loading

0 comments on commit b5a1d2c

Please sign in to comment.