Skip to content

Commit

Permalink
Quicksight principals in data source creation
Browse files Browse the repository at this point in the history
  • Loading branch information
dlpzx committed Aug 2, 2022
1 parent 72225ad commit 39b515f
Showing 1 changed file with 4 additions and 17 deletions.
21 changes: 4 additions & 17 deletions backend/dataall/aws/handlers/quicksight.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,9 @@ def can_import_dashboard(AwsAccountId, region, UserName, DashboardId):
@staticmethod
def create_data_source_vpc(AwsAccountId, region, UserName, vpcConnectionId):
client = Quicksight.get_quicksight_client(AwsAccountId, region)
user = Quicksight.describe_user(AwsAccountId, UserName)
if not user:
return False
identity_region = 'us-east-1'

user = Quicksight.register_user(AwsAccountId, UserName, UserRole='AUTHOR')
try:
response = client.describe_data_source(
AwsAccountId=AwsAccountId, DataSourceId="dataall-metadata-db"
Expand Down Expand Up @@ -304,7 +304,7 @@ def create_data_source_vpc(AwsAccountId, region, UserName, vpcConnectionId):
},
Permissions=[
{
"Principal": user.get('Arn'),
"Principal": f"arn:aws:quicksight:{identity_region}:{AwsAccountId}:group/default/dataall",
"Actions": [
"quicksight:UpdateDataSourcePermissions",
"quicksight:DescribeDataSource",
Expand All @@ -320,19 +320,6 @@ def create_data_source_vpc(AwsAccountId, region, UserName, vpcConnectionId):
}
)

response = client.update_data_source_permissions(
AwsAccountId=AwsAccountId,
DataSourceId="dataall-metadata-db",
GrantPermissions=[
{
'Principal': 'string',
'Actions': [
'string',
]
},
]
)

return "dataall-metadata-db"

@staticmethod
Expand Down

0 comments on commit 39b515f

Please sign in to comment.