-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Private Datasets: Update use case: Creating a dataset (#761)
* AddCommand: add "--public" argument * Command::before_run(): introduce * AddCommand::before_run(): add single-tenant check * DatasetRepository::create_dataset_from_snapshot(): add "publicly_available" argument * Register RebacService * Updates after painful rebasing * CreateDatasetFromSnapshotUseCase: add Options (mostly for DatasetVisibility) * CreateDatasetFromSnapshotUseCaseImpl: use Options * DatasetRepository{LocalFs,S3}: move RebacService in favor of use cases * AddCommand: provide Options for the use case * Correct import names after rebasing: RebacRepositoryInMem -> InMemoryRebacRepository * CreateDatasetFromSnapshotUseCase: use default options in tests * create_dataset_from_snapshot_impl: remove outdated docstring * Remove "cli_arguments" experiment * CreateDatasetUseCase: add a todo * AddCommand: get multi-tenantness from the dataset repo * CreateDatasetFromSnapshotUseCaseOptions: remove "is_multi_tenant_workspace" * GQL: DatasetsMut::{createEmpty, createFromSnapshot}(): add "datasetPubliclyAvailable" argument * DatasetRepositoryWriter: is superset of DatasetRepository * DatasetVisibility: remove confusing Default derive * AddCommand: support dataset visibility as a value, not a bool flag * kamu-cli, prepare_dependencies_graph_repository(): remove outdated deps * kamu-cli: register SqliteRebacRepository * kamu-cli: move InMemoryRebacRepository to the right place (configure_in_memory_components) * DatasetRepositoryWriter: revert: now is not superset of DatasetRepository * Fix tests after merge conflict fixes * kamu-adapter-auth-oso: remove unused deps * CreateDatasetFromSnapshotUseCaseImpl: cleanup of the created dataset, in case of a ReBAC property set failure * kamu-auth-rebac: add MockRebacRepository hidden by the "testing" feature gate * CreateDatasetFromSnapshotUseCase: check ReBAC stuff in tests * test_created_datasets_have_the_correct_visibility_attribute(): add * test_clearing_the_dataset_if_a_rebac_property_setting_error(): add * CHANGELOG.md: update * RebacRepository: absorb "mockall" import into the derive * kamu-cli, command_needs_transaction(): add AddCommand * GQL: DatasetsMut::{create_empty,create_from_snapshot}(): use DatasetVisibility * CreateDatasetFromSnapshotUseCase::execute(): pass "options" by value * Move ReBAC logic outside of Use Cases * test_created_datasets_have_the_correct_visibility_attribute(): use OutboxImmediate * test_clearing_the_dataset_if_a_rebac_property_setting_error(): remove outdated * RebacServiceImpl::handle_dataset_lifecycle_deleted_message() * DatasetLifecycleMessage::Renamed(): introduce * RebacServiceImpl::handle_dataset_lifecycle_renamed_message() * InMemoryRebacRepository::delete_entity_properties(): implement * SqliteRebacRepository::delete_entity_properties(): implement * DatasetLifecycleMessage::Renamed(): removed -- in fact, we don't really need to handle renaming, since we store IDs * CHANGELOG.md: add recommendation re ordering * CHANGELOG.md: update * command_needs_transaction(): AddCommand no longer requires a transaction * CreateDatasetUseCaseImpl: update todo * InternalError::bail(): simplify implementation * CreateDatasetUseCase::execute(): add "options" argument * CreateDatasetFromSnapshotUseCase::execute(): use CreateDatasetUseCaseOptions as type * RebacServiceImpl: remove pub modifier for message handlers * Remove unused kamu-auth-rebac-{inmem,services} crates from tests * RebacService::{delete_dataset_properties,delete_account_dataset_relation}(): idempotent errors * RebacServiceImpl: do not lose errors context * MultiTenantRebacDatasetLifecycleMessageConsumer: extract * DatasetVisibility: PubliclyAvailable -> Public * kamu-cli, value_parse_dataset_visibility(): reuse serde_yaml * CreateDatasetUseCaseOptions: add the Default derive * kamu-auth-rebac-services: absorb consumer tests * CHANGELOG.md: correct after rebase * DatasetVisibility: rename is_publicly_available() to is_public() * RebacServiceImpl::delete_dataset_properties(): remove an outdated todo * kamu-auth-rebac-services, test_rebac_properties_added(): update var names for readability * DatasetLifecycleMessageCreated:dataset_visibility(): add deserialization default
- Loading branch information
Showing
92 changed files
with
1,024 additions
and
124 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Copyright Kamu Data, Inc. and contributors. All rights reserved. | ||
// | ||
// Use of this software is governed by the Business Source License | ||
// included in the LICENSE file. | ||
// | ||
// As of the Change Date specified in that file, in accordance with | ||
// the Business Source License, use of this software will be governed | ||
// by the Apache License, Version 2.0. | ||
|
||
use kamu::domain; | ||
|
||
use crate::prelude::*; | ||
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// | ||
|
||
#[derive(Enum, Debug, Clone, Copy, PartialEq, Eq)] | ||
pub enum DatasetVisibility { | ||
Private, | ||
Public, | ||
} | ||
|
||
impl From<domain::DatasetVisibility> for DatasetVisibility { | ||
fn from(value: domain::DatasetVisibility) -> Self { | ||
match value { | ||
domain::DatasetVisibility::Private => Self::Private, | ||
domain::DatasetVisibility::Public => Self::Public, | ||
} | ||
} | ||
} | ||
|
||
impl From<DatasetVisibility> for domain::DatasetVisibility { | ||
fn from(value: DatasetVisibility) -> Self { | ||
match value { | ||
DatasetVisibility::Private => domain::DatasetVisibility::Private, | ||
DatasetVisibility::Public => domain::DatasetVisibility::Public, | ||
} | ||
} | ||
} | ||
|
||
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.