-
Notifications
You must be signed in to change notification settings - Fork 23
feat(file-based): sync file acl permissions and identities #260
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
Merged
Merged
Changes from 46 commits
Commits
Show all changes
51 commits
Select commit
Hold shift + click to select a range
79c5f40
file-based: initial implementation to sync metadarecords
aldogonzalez8 4638f89
file-based: fix lint
aldogonzalez8 266c0cd
file-based: fix errors
aldogonzalez8 7bfb8c3
Auto-fix lint and format issues
88af543
file-based: remove abstract decorator
aldogonzalez8 7e6ca59
Merge branch 'main' into aldogonzalez8/sync-metadata-records2
aaronsteers edd6f69
file-based: fix check
aldogonzalez8 35e0e68
file-based: add identities stream and rename acl toggle
aldogonzalez8 0ae4267
Auto-fix lint and format issues
43e3ea3
file-based: fix annoying mypy issues
aldogonzalez8 4aee2c9
file-based: minor fix to schema
aldogonzalez8 7b5c245
file-based: add logger to load_identity_groups method
aldogonzalez8 f022b4c
file-based: simplify sync permissions schema
aldogonzalez8 597e458
file-based: remove unused config and fix unit tests
aldogonzalez8 2430eae
file-based: format record to have file last modified data
aldogonzalez8 24a93ba
file-based: create three toggle instead of option below transfer records
aldogonzalez8 40c1787
file-based: fix csv test
aldogonzalez8 36e0bca
Auto-fix lint and format issues
d30b1ad
file-based: make new methods abstract
aldogonzalez8 b5cf88c
file-based: add check for identities stream
aldogonzalez8 2a04f12
file-based: ruff format
aldogonzalez8 4c18889
Auto-fix lint and format issues
4e5bb90
Merge branch 'main' into aldogonzalez8/sync-metadata-records2
aldogonzalez8 1271e3a
file-based: add notImplemented error
aldogonzalez8 4105c3c
file-based: fix unit tests
aldogonzalez8 a6d1b62
file-based: add NotImplementedError
aldogonzalez8 a7081d3
file-based: allow connector to provide permissions and identities sch…
aldogonzalez8 7e4d73f
file-based: move permissions transfer mode to general with abstract I…
aldogonzalez8 0f5cc5f
Auto-fix lint and format issues
a36ec7d
file-based: remove unnecesary param in Abstract Identities
aldogonzalez8 ad4c49c
file-based: fix init return types
aldogonzalez8 750935c
file-based: update interfaces to obtain schemas for file_permissions …
aldogonzalez8 d4f2b1d
file-based: update transfer mode validations
aldogonzalez8 4962949
file-based: update docstrings for abstract methos
aldogonzalez8 ea31a2d
file-based: add method in stream reader to obtain Identities schema
aldogonzalez8 428c669
Auto-fix lint and format issues
791241c
file-based: implement get schema method/proerty in unit tests
aldogonzalez8 b74a005
file-based: update messages for not implemented errors
aldogonzalez8 2c08bb4
file-based: create new stream for acls so we can save from if-else pa…
aldogonzalez8 a71eb08
Auto-fix lint and format issues
a41934a
file-based: add unit tests for Permissions Stream
aldogonzalez8 b764d46
file-based: add more tests for permissions file based stream
aldogonzalez8 9566b3c
file-based: add docstrings to some methods
aldogonzalez8 8612d4b
file-based: add docstrings to some methods
aldogonzalez8 c94b704
file-based: user better example of schema for file permissions in test
aldogonzalez8 722c7e0
file-based: add tests for identities stream
aldogonzalez8 54d5ec6
Auto-fix lint and format issues
afdd60a
file-based: minor change in unit tests
aldogonzalez8 7b2ffce
file-based: move test to correct folder
aldogonzalez8 1b729d7
file-based: rename streams to follow pattern and add more docs to met…
aldogonzalez8 7924c3d
file-based: rename stream file to correct pattern
aldogonzalez8 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
80 changes: 80 additions & 0 deletions
80
airbyte_cdk/sources/file_based/config/validate_config_transfer_modes.py
This file contains hidden or 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,80 @@ | ||
# | ||
# Copyright (c) 2025 Airbyte, Inc., all rights reserved. | ||
# | ||
|
||
from airbyte_cdk.sources.file_based.config.abstract_file_based_spec import ( | ||
AbstractFileBasedSpec, | ||
DeliverRawFiles, | ||
) | ||
from airbyte_cdk.sources.specs.transfer_modes import DeliverPermissions | ||
|
||
DELIVERY_TYPE_KEY = "delivery_type" | ||
DELIVERY_TYPE_PERMISSION_TRANSFER_MODE_VALUE = "use_permissions_transfer" | ||
DELIVERY_TYPE_FILES_TRANSFER_MODE_VALUE = "use_file_transfer" | ||
PRESERVE_DIRECTORY_STRUCTURE_KEY = "preserve_directory_structure" | ||
INCLUDE_IDENTITIES_STREAM_KEY = "include_identities_stream" | ||
|
||
|
||
def use_file_transfer(parsed_config: AbstractFileBasedSpec) -> bool: | ||
return ( | ||
hasattr(parsed_config.delivery_method, DELIVERY_TYPE_KEY) | ||
and parsed_config.delivery_method.delivery_type == DELIVERY_TYPE_FILES_TRANSFER_MODE_VALUE | ||
) | ||
|
||
|
||
def preserve_directory_structure(parsed_config: AbstractFileBasedSpec) -> bool: | ||
""" | ||
Determines whether to preserve directory structure during file transfer. | ||
|
||
When enabled, files maintain their subdirectory paths in the destination. | ||
When disabled, files are flattened to the root of the destination. | ||
|
||
Args: | ||
parsed_config: The parsed configuration containing delivery method settings | ||
|
||
Returns: | ||
True if directory structure should be preserved (default), False otherwise | ||
""" | ||
if ( | ||
use_file_transfer(parsed_config) | ||
and hasattr(parsed_config.delivery_method, PRESERVE_DIRECTORY_STRUCTURE_KEY) | ||
and isinstance(parsed_config.delivery_method, DeliverRawFiles) | ||
): | ||
return parsed_config.delivery_method.preserve_directory_structure | ||
return True | ||
|
||
|
||
def use_permissions_transfer(parsed_config: AbstractFileBasedSpec) -> bool: | ||
""" | ||
Determines whether to use permissions transfer to sync ACLs and Identities | ||
|
||
Args: | ||
parsed_config: The parsed configuration containing delivery method settings | ||
|
||
Returns: | ||
True if permissions transfer should be enabled, False otherwise | ||
""" | ||
return ( | ||
hasattr(parsed_config.delivery_method, DELIVERY_TYPE_KEY) | ||
and parsed_config.delivery_method.delivery_type | ||
== DELIVERY_TYPE_PERMISSION_TRANSFER_MODE_VALUE | ||
) | ||
|
||
|
||
def include_identities_stream(parsed_config: AbstractFileBasedSpec) -> bool: | ||
""" | ||
There are scenarios where user may not have access to identities but still is valuable to get ACLs | ||
|
||
Args: | ||
parsed_config: The parsed configuration containing delivery method settings | ||
|
||
Returns: | ||
True if we should include Identities stream. | ||
""" | ||
if ( | ||
use_permissions_transfer(parsed_config) | ||
and hasattr(parsed_config.delivery_method, INCLUDE_IDENTITIES_STREAM_KEY) | ||
and isinstance(parsed_config.delivery_method, DeliverPermissions) | ||
): | ||
return parsed_config.delivery_method.include_identities_stream | ||
return False |
This file contains hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from airbyte_cdk.sources.file_based.stream.abstract_file_based_stream import AbstractFileBasedStream | ||
from airbyte_cdk.sources.file_based.stream.default_file_based_stream import DefaultFileBasedStream | ||
from airbyte_cdk.sources.file_based.stream.identities_stream import FileIdentities | ||
|
||
__all__ = ["AbstractFileBasedStream", "DefaultFileBasedStream"] | ||
__all__ = ["AbstractFileBasedStream", "DefaultFileBasedStream", "FileIdentities"] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.