Skip to content
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

User Permissions on TestSuite and TestCases #19072

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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<TestCase> response =
repository.deleteTestCaseFromLogicalTestSuite(testSuiteId, id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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())) {
Expand Down Expand Up @@ -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())) {
Expand Down
Loading