-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generic shares_base module and specific s3_datasets_shares module - part 3 (share processor and manager interfaces) #1298
Conversation
backend/dataall/modules/shares_base/services/sharing_service.py
Outdated
Show resolved
Hide resolved
2c78c13
to
d92479d
Compare
d92479d
to
5b7c1d0
Compare
# Conflicts: # backend/dataall/modules/s3_datasets_shares/services/share_object_service.py
Testing locally:Approve sharesFirst we will test that sharing works. After approve the share task is correctly handled. And items are processed as usual. We will test success cases. For folders and tables, we also need to verify UI permissions (GET_TABLE, GET_FOLDER) are attached
Then unsuccessful cases:
Mix of success/failures:
Then cases with the dataset_lock:
Revoke sharesAfter revoke the share task is correctly handled. And items are processed as usual. We will test success cases. For folders and tables, we also need to verify UI permissions (GET_TABLE, GET_FOLDER) are removed
Then unsuccessful cases:
Then cases with the dataset_lock:
Verify shares
Re-apply shares
Testing in AWSNeeded as we are changing the ECS tasks and the handlers. We just need tot est that the handler triggers the ECS tasks and that the processors are loaded:
Found issues:
|
@@ -537,73 +538,6 @@ def _validate_group_membership(session, share_object_group, environment_uri): | |||
message=f'Team: {share_object_group} is not a member of the environment {environment_uri}', | |||
) | |||
|
|||
@staticmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is moved to the share_item_service because now it applies to each item, not to the whole share
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried having github rename and edit the file backend/dataall/modules/s3_datasets_shares/services/share_processors/lakeformation_process_share.py
but it is ignoring it. The same for the other processors. The inside logic has barely being touched, just the construction
source_env_group, | ||
env_group, | ||
) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get_share_data_items_by_type is new, it replaces get_share_data_items called in the data_sharing_service
(shared_tables, shared_folders, shared_buckets) = ShareObjectRepository.get_share_data_items(
session, share_uri, ShareItemStatus.Share_Approved.value
)
def list_all_active_share_objects(session) -> [ShareObject]: | ||
return session.query(ShareObject).filter(ShareObject.deleted.is_(None)).all() | ||
|
||
@staticmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This one has suffered some modifications. We can now send a message
@@ -241,13 +238,6 @@ def __init__(self, state): | |||
] | |||
}, | |||
), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This transition is unnecessary if we make a failure more flexible
@@ -4,7 +4,6 @@ | |||
class ShareableType(GraphQLEnumMapper): | |||
Table = 'DatasetTable' | |||
StorageLocation = 'DatasetStorageLocation' | |||
View = 'View' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove unused. I know it could have waited for another PR, but it was very very small
@@ -1498,21 +1498,6 @@ def test_verify_items_share_request(db, client, user2, group2, share3_processed, | |||
assert status == ShareItemHealthStatus.PendingVerify.value | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed because this function does not exist anymore, but we will introduce more tests once the refactoring is done
d2ffa77
to
a7940f1
Compare
Feature or Bugfix
Detail
As explained in the design for #1123 and #1283 we are trying to implement generic
datasets_base
andshares_base
modules that can be used by any type of datasets and by any type of shareable object in a generic way.In this PR:
DatasetBaseRepository.get_dataset_by_uri(session, share.datasetUri)
to avoid future circular dependencies: shares_base depends only on datasets_base.SHARES_TASK
and register ShareProcessors in s3_datasets_share (backend/dataall/modules/s3_datasets_shares/__init__.py
)See full detail of SharingService design in #1283
Next steps/Open questions
For failures I think we should rollback whatever actions where performed. For example, if we are sharing a table and it failed in one step, it should revert all the steps executed before. @petrkalos @SofiaSazonova @noah-paige what do you think?
Relates
Security
Please answer the questions below briefly where applicable, or write
N/A
. Based onOWASP 10.
fetching data from storage outside the application (e.g. a database, an S3 bucket)?
eval
or similar functions are used?By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.