diff --git a/backend/dataall/core/stacks/api/resolvers.py b/backend/dataall/core/stacks/api/resolvers.py index 3167f6b24..22f1b7fa5 100644 --- a/backend/dataall/core/stacks/api/resolvers.py +++ b/backend/dataall/core/stacks/api/resolvers.py @@ -60,11 +60,8 @@ def resolve_events(context, source: Stack, **kwargs): def resolve_stack_visibility(context, source: Stack, **kwargs): if not source: return False - log_config = config.get_property(map_target_type_to_log_config_path(target_type=source.stack), 'enabled') try: - return StackService.check_if_user_allowed_view_logs( - target_type=source.stack, target_uri=source.targetUri, config=log_config - ) + return StackService.check_if_user_allowed_view_logs(target_type=source.stack, target_uri=source.targetUri) except Exception as e: log.error(f'Failed to check if the user is allowed to view stack logs due to: {e}') return False diff --git a/backend/dataall/core/stacks/services/stack_service.py b/backend/dataall/core/stacks/services/stack_service.py index 289f2197d..a61f93b87 100644 --- a/backend/dataall/core/stacks/services/stack_service.py +++ b/backend/dataall/core/stacks/services/stack_service.py @@ -206,8 +206,7 @@ def update_stack_tags(input): @staticmethod def get_stack_logs(target_uri, target_type): context = get_context() - log_config = config.get_property(map_target_type_to_log_config_path(target_type=target_type), 'enabled') - StackService.check_if_user_allowed_view_logs(target_type=target_type, target_uri=target_uri, config=log_config) + StackService.check_if_user_allowed_view_logs(target_type=target_type, target_uri=target_uri) StackRequestVerifier.verify_target_type_and_uri(target_uri, target_type) with context.db_engine.scoped_session() as session: @@ -242,12 +241,13 @@ def get_stack_logs(target_uri, target_type): default_value='enabled', resolve_property=map_target_type_to_log_config_path, ) - def check_if_user_allowed_view_logs(target_type: str, target_uri: str, config: str): + def check_if_user_allowed_view_logs(target_type: str, target_uri: str): context = get_context() - if config == 'admin-only' and 'DAAdministrators' not in context.groups: + config_value = config.get_property(map_target_type_to_log_config_path(target_type=target_type), 'enabled') + if config_value == 'admin-only' and 'DAAdministrators' not in context.groups: raise exceptions.ResourceUnauthorized( username=context.username, action='View Stack logs', - resource_uri=f'{target_uri} ( Resource type: {target_type})', + resource_uri=f'{target_uri} ( Resource type: {target_type} )', ) return True