diff --git a/src/main/java/org/tkit/onecx/permission/bff/rs/controllers/AssignmentRestController.java b/src/main/java/org/tkit/onecx/permission/bff/rs/controllers/AssignmentRestController.java index c1f91df..f4fa508 100644 --- a/src/main/java/org/tkit/onecx/permission/bff/rs/controllers/AssignmentRestController.java +++ b/src/main/java/org/tkit/onecx/permission/bff/rs/controllers/AssignmentRestController.java @@ -45,8 +45,8 @@ public Response createAssignment(CreateAssignmentRequestDTO createAssignmentRequ } @Override - public Response createProductAssignments(CreateProductAssignmentsRequestDTO createProductAssignmentsRequestDTO) { - try (Response response = assignmentClient.createProductAssignment(mapper.map(createProductAssignmentsRequestDTO))) { + public Response grantAssignments(CreateProductAssignmentsRequestDTO createProductAssignmentsRequestDTO) { + try (Response response = assignmentClient.grantAssignment(mapper.map(createProductAssignmentsRequestDTO))) { return Response.status(response.getStatus()).build(); } } diff --git a/src/main/openapi/openapi-bff.yaml b/src/main/openapi/openapi-bff.yaml index d9deb1b..28d60d8 100644 --- a/src/main/openapi/openapi-bff.yaml +++ b/src/main/openapi/openapi-bff.yaml @@ -274,7 +274,7 @@ paths: application/json: schema: $ref: '#/components/schemas/ProblemDetailResponse' - /assignments/product: + /assignments/grant: post: x-onecx: permissions: @@ -282,8 +282,8 @@ paths: - write tags: - assignment - description: Create new assignments for products - operationId: createProductAssignments + description: Create new assignments by criteria + operationId: grantAssignments requestBody: required: true content: @@ -292,7 +292,7 @@ paths: $ref: '#/components/schemas/CreateProductAssignmentsRequest' responses: 201: - description: New assignment created + description: New assignments created 400: description: Bad request content: @@ -714,10 +714,11 @@ components: type: object required: - roleId - - productNames properties: roleId: type: string + appId: + type: string productNames: type: array items: @@ -729,6 +730,8 @@ components: properties: roleId: type: string + appId: + type: string permissionId: type: string productNames: diff --git a/src/test/java/org/tkit/onecx/permission/rs/AssignmentRestControllerTest.java b/src/test/java/org/tkit/onecx/permission/rs/AssignmentRestControllerTest.java index ca777c4..595b221 100644 --- a/src/test/java/org/tkit/onecx/permission/rs/AssignmentRestControllerTest.java +++ b/src/test/java/org/tkit/onecx/permission/rs/AssignmentRestControllerTest.java @@ -257,7 +257,7 @@ void createProductAssignmentsTest() { request.setProductNames(List.of("product1")); // create mock rest endpoint - mockServerClient.when(request().withPath("/internal/assignments/product").withMethod(HttpMethod.POST) + mockServerClient.when(request().withPath("/internal/assignments/grant").withMethod(HttpMethod.POST) .withBody(JsonBody.json(request))) .withId(MOCKID) .respond(httpRequest -> response().withStatusCode(Response.Status.CREATED.getStatusCode()) @@ -272,7 +272,7 @@ void createProductAssignmentsTest() { .header(APM_HEADER_PARAM, ADMIN) .contentType(APPLICATION_JSON) .body(requestDTO) - .post("/product") + .post("/grant") .then() .statusCode(Response.Status.CREATED.getStatusCode()); }