Skip to content

Commit 3ef5dd0

Browse files
feat: add main dataset sharing on runner or scenario sharing
1 parent c1dc19c commit 3ef5dd0

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

runner/src/main/kotlin/com/cosmotech/runner/service/RunnerService.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -518,19 +518,19 @@ class RunnerService(
518518
val linkedDataset =
519519
datasetApiService.findByOrganizationIdAndDatasetId(
520520
this.runner.organizationId!!, datasetId)
521-
if (linkedDataset!!.main == true) return@forEach
521+
if (datasetRole == ROLE_NONE && linkedDataset!!.main == true) return@forEach
522522
// If the dataset default security is different from none,
523523
// Then it's already viewer or higher and doesn't need to change
524-
if (datasetRole == ROLE_VIEWER && linkedDataset.security!!.default != ROLE_NONE)
524+
if (datasetRole == ROLE_VIEWER && linkedDataset!!.security!!.default != ROLE_NONE)
525525
return@forEach
526526
// If the dataset default security is different from viewer,
527527
// Then it's either already none or higher than viewer and doesn't need to change
528-
if (datasetRole == ROLE_NONE && linkedDataset.security!!.default != ROLE_VIEWER)
528+
if (datasetRole == ROLE_NONE && linkedDataset!!.security!!.default != ROLE_VIEWER)
529529
return@forEach
530530
// Filter on dataset copy (because we do not want to update main dataset as it can be shared
531531
// between runners)
532532
datasetApiService.updateDefaultSecurity(
533-
this.runner.organizationId!!, linkedDataset, datasetRole)
533+
this.runner.organizationId!!, linkedDataset!!, datasetRole)
534534
}
535535
}
536536
}

scenario/src/main/kotlin/com/cosmotech/scenario/service/ScenarioServiceImpl.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,13 +1169,13 @@ internal class ScenarioServiceImpl(
11691169
if (scenarioRole == ROLE_NONE) datasetRole = ROLE_NONE
11701170
scenario.datasetList!!.forEach { datasetId ->
11711171
val dataset = datasetService.findByOrganizationIdAndDatasetId(organizationId, datasetId)
1172-
if (dataset!!.main == true) return@forEach
1172+
if (datasetRole == ROLE_NONE && dataset!!.main == true) return@forEach
11731173
// We do not want to lower the default security if it's higher than viewer
1174-
if (datasetRole == ROLE_VIEWER && dataset.security!!.default != ROLE_NONE) return@forEach
1175-
if (datasetRole == ROLE_NONE && dataset.security!!.default != ROLE_VIEWER) return@forEach
1174+
if (datasetRole == ROLE_VIEWER && dataset!!.security!!.default != ROLE_NONE) return@forEach
1175+
if (datasetRole == ROLE_NONE && dataset!!.security!!.default != ROLE_VIEWER) return@forEach
11761176
// Filter on dataset copy (because we do not want to update main dataset as it can be shared
11771177
// between scenarios)
1178-
datasetService.updateDefaultSecurity(organizationId, dataset, datasetRole)
1178+
datasetService.updateDefaultSecurity(organizationId, dataset!!, datasetRole)
11791179
}
11801180
}
11811181

0 commit comments

Comments
 (0)