diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestSuiteRepository.java b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestSuiteRepository.java index 7d4b486e8f08..63863c1e09b0 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestSuiteRepository.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/jdbi3/TestSuiteRepository.java @@ -154,6 +154,14 @@ public void setFullyQualifiedName(TestSuite testSuite) { } } + @Override + public EntityInterface getParentEntity(TestSuite entity, String fields) { + if (entity.getExecutable()) { + return Entity.getEntity(entity.getExecutableEntityReference(), fields, ALL); + } + return null; + } + private TestSummary getTestCasesExecutionSummary(JsonObject aggregation) { // Initialize the test summary with 0 values TestSummary testSummary = diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java index 4e96e18eba93..ee49b6d17bb4 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestCaseResource.java @@ -830,7 +830,7 @@ public Response delete( String fqn) { ResourceContextInterface resourceContext = TestCaseResourceContext.builder().name(fqn).build(); OperationContext operationContext = - new OperationContext(Entity.TABLE, MetadataOperation.EDIT_TESTS); + new OperationContext(Entity.TEST_CASE, MetadataOperation.DELETE); authorizer.authorize(securityContext, operationContext, resourceContext); return deleteByName(uriInfo, securityContext, fqn, recursive, hardDelete); } @@ -854,7 +854,7 @@ public Response deleteLogicalTestCase( @PathParam("id") UUID id) { ResourceContextInterface resourceContext = TestCaseResourceContext.builder().id(id).build(); OperationContext operationContext = - new OperationContext(Entity.TEST_SUITE, MetadataOperation.EDIT_TESTS); + new OperationContext(Entity.TEST_CASE, MetadataOperation.DELETE); authorizer.authorize(securityContext, operationContext, resourceContext); DeleteResponse response = repository.deleteTestCaseFromLogicalTestSuite(testSuiteId, id); diff --git a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestSuiteResource.java b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestSuiteResource.java index bc4887c1d5d0..b89e085d2f78 100644 --- a/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestSuiteResource.java +++ b/openmetadata-service/src/main/java/org/openmetadata/service/resources/dqtests/TestSuiteResource.java @@ -689,7 +689,8 @@ public Response delete( @Parameter(description = "Id of the logical test suite", schema = @Schema(type = "UUID")) @PathParam("id") UUID id) { - OperationContext operationContext = new OperationContext(entityType, MetadataOperation.DELETE); + OperationContext operationContext = + new OperationContext(Entity.TEST_SUITE, MetadataOperation.DELETE); authorizer.authorize(securityContext, operationContext, getResourceContextById(id)); TestSuite testSuite = Entity.getEntity(Entity.TEST_SUITE, id, "*", ALL); if (Boolean.TRUE.equals(testSuite.getExecutable())) { @@ -724,7 +725,8 @@ public Response delete( @Parameter(description = "FQN of the logical test suite", schema = @Schema(type = "String")) @PathParam("name") String name) { - OperationContext operationContext = new OperationContext(entityType, MetadataOperation.DELETE); + OperationContext operationContext = + new OperationContext(Entity.TEST_SUITE, MetadataOperation.DELETE); authorizer.authorize(securityContext, operationContext, getResourceContextByName(name)); TestSuite testSuite = Entity.getEntityByName(Entity.TEST_SUITE, name, "*", ALL); if (Boolean.TRUE.equals(testSuite.getExecutable())) {