Skip to content

Commit

Permalink
Add cross-region sharing error message/exception (#322)
Browse files Browse the repository at this point in the history
### Feature or Bugfix
- Feature/Bugfix

### Detail
- Cross-region sharing is not possible for table sharing because Lake
Formation does not allow (yet) cross region sharing.
- Cross-region sharing of folders using access points currently includes
errors in the implemented policy
For this reason for the time being we display an error for cross-region
sharing to disallow this behaviour

### Relates
- #318

By submitting this pull request, I confirm that my contribution is made
under the terms of the Apache 2.0 license.
  • Loading branch information
dlpzx committed Mar 6, 2023
1 parent f2842df commit a64530f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions backend/dataall/db/api/share_object.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,13 @@ def create_share_object(
'environment',
api.Environment.get_environment_by_uri(session, environmentUri),
)

if environment.region != dataset.region:
raise exceptions.UnauthorizedOperation(
action=permissions.CREATE_SHARE_OBJECT,
message=f'Requester Team {groupUri} works in region {environment.region} and the requested dataset is stored in region {dataset.region}',
)

if principalType == models.PrincipalType.ConsumptionRole.value:
consumption_role: models.ConsumptionRole = api.Environment.get_environment_consumption_role(
session,
Expand Down

0 comments on commit a64530f

Please sign in to comment.