From 45e45fb31568a6e11ca295e418ed8c5a006a54e8 Mon Sep 17 00:00:00 2001 From: Okke Harsta Date: Wed, 6 Nov 2024 13:52:29 +0100 Subject: [PATCH] Added operation info for InternalInviteController#deleteRole --- .../internal/InternalInviteController.java | 35 ++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/access/internal/InternalInviteController.java b/server/src/main/java/access/internal/InternalInviteController.java index a7b48094..ad737f50 100644 --- a/server/src/main/java/access/internal/InternalInviteController.java +++ b/server/src/main/java/access/internal/InternalInviteController.java @@ -15,6 +15,7 @@ import io.swagger.v3.oas.annotations.Hidden; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.enums.ParameterIn; import io.swagger.v3.oas.annotations.media.Content; import io.swagger.v3.oas.annotations.media.ExampleObject; import io.swagger.v3.oas.annotations.media.Schema; @@ -234,6 +235,38 @@ public ResponseEntity updateRole(@Validated @RequestBody Role role, @DeleteMapping("/roles/{id}") @PreAuthorize("hasRole('SP_DASHBOARD')") + @Operation(summary = "Delete existing Role", + description = "Delete an existing role. The path parameter id is the id returned when creating the role.", + parameters = {@Parameter(name = "id", in = ParameterIn.PATH, description = "Unique database id of the role", required = true)}, + responses = { + @ApiResponse(responseCode = "204", description = "No content"), + @ApiResponse(responseCode = "400", description = "BadRequest", + content = {@Content(schema = @Schema(implementation = StatusResponse.class), + examples = {@ExampleObject(value = """ + { + "timestamp": 1717672263253, + "status": 400, + "error": "BadRequest", + "exception": "access.exception.UserRestrictionException", + "message": "No access to role", + "path": "/api/internal/roles/999" + } + """ + )})}), + @ApiResponse(responseCode = "404", description = "Role not found", + content = {@Content(schema = @Schema(implementation = StatusResponse.class), + examples = {@ExampleObject(value = """ + { + "timestamp": 1717672263253, + "status": 404, + "error": "Not found", + "exception": "access.exception.NotFoundException", + "message": "Role not found", + "path": "/api/internal/roles/999" + } + """ + )})})}) + public ResponseEntity deleteRole(@PathVariable("id") Long id, @Parameter(hidden = true) @AuthenticationPrincipal RemoteUser remoteUser) { Role role = roleRepository.findById(id).orElseThrow(() -> new NotFoundException("Role not found")); @@ -254,7 +287,7 @@ public ResponseEntity deleteRole(@PathVariable("id") Long id, @PostMapping("/invitations") @PreAuthorize("hasRole('SP_DASHBOARD')") @Operation(summary = "Invite member for existing Role", - description = "Invite a member for an existing role. An invitation email will be sent. Do not forget to set to ", + description = "Invite a member for an existing role. An invitation email will be sent. Do not forget to set guestRoleIncluded to true.", requestBody = @io.swagger.v3.oas.annotations.parameters.RequestBody( useParameterTypeSchema = true, content = {@Content(examples = {@ExampleObject(value = """