-
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
Added permission check - is tenant to update SSM parameters API #1714
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,6 +9,8 @@ | |
from dataall.core.permissions.services.permission_service import PermissionService | ||
from dataall.core.permissions.db.tenant.tenant_models import Tenant | ||
from dataall.base.services.service_provider_factory import ServiceProviderFactory | ||
from dataall.base.aws.sts import SessionHelper | ||
from dataall.base.aws.parameter_store import ParameterStoreManager | ||
import logging | ||
import os | ||
from functools import wraps | ||
|
@@ -121,6 +123,26 @@ def validate_permissions(session, tenant_name, g_permissions, group): | |
return tenant_group_permissions | ||
|
||
|
||
class TenantActionsService: | ||
@staticmethod | ||
def update_monitoring_ssm_parameter(name, value): | ||
# raises UnauthorizedOperation exception, if there is no admin access | ||
context = get_context() | ||
TenantPolicyValidationService.validate_admin_access( | ||
context.username, context.groups, 'UPDATE_SSM_PARAMETER_MONITORING' | ||
) | ||
|
||
current_account = SessionHelper.get_account() | ||
region = os.getenv('AWS_REGION', 'eu-west-1') | ||
response = ParameterStoreManager.update_parameter( | ||
AwsAccountId=current_account, | ||
region=region, | ||
parameter_name=f'/dataall/{os.getenv("envname", "local")}/quicksightmonitoring/{name}', | ||
parameter_value=value, | ||
) | ||
Comment on lines
+137
to
+142
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this is carry over from resolver code - but this does not work... All of the following use ParameterStore and try to assume into pivotRole in infra account to get SSM (pivot role DNE in infra account) Will approve this PR but leave this comment in https://github.com/data-dot-all/dataall/pull/1712/files where I think more focus is on QuickSight Monitoring View |
||
return response | ||
|
||
|
||
class TenantPolicyService: | ||
TENANT_NAME = 'dataall' | ||
|
||
|
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.
are we keeping this API or removing this along with other Admin Dashboard ones?
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 see what you did in https://github.com/data-dot-all/dataall/pull/1712/files