@Test @WithMockUser(authorities = { "VIEW_ENDPOINT_ACL" }) public void getEndpointAccesRights() { List<ServiceClient> serviceClients = endpointsApiController.getEndpointServiceClients("6").getBody(); assertTrue(serviceClients.size() == 3); assertTrue(serviceClients.stream() .anyMatch(sc -> sc.getId().equals(TestUtils.CLIENT_ID_SS6))); assertTrue(serviceClients.stream() .anyMatch(sc -> sc.getId().equals("2"))); }
@Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT_ACL')") public ResponseEntity<List<ServiceClient>> getEndpointServiceClients(String id) { Long endpointId = parseLongIdOrThrowNotFound(id); List<ServiceClientDto> serviceClientsByEndpoint; try { serviceClientsByEndpoint = serviceClientService.getServiceClientsByEndpoint(endpointId); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } catch (ClientNotFoundException e) { throw new ConflictException(e); } List<ServiceClient> serviceClients = serviceClientConverter .convertServiceClientDtos(serviceClientsByEndpoint); Collections.sort(serviceClients, serviceClientSortingComparator); return new ResponseEntity<>(serviceClients, HttpStatus.OK); }
EndpointsApiController implements EndpointsApi { @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT_ACL')") public ResponseEntity<List<ServiceClient>> getEndpointServiceClients(String id) { Long endpointId = parseLongIdOrThrowNotFound(id); List<ServiceClientDto> serviceClientsByEndpoint; try { serviceClientsByEndpoint = serviceClientService.getServiceClientsByEndpoint(endpointId); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } catch (ClientNotFoundException e) { throw new ConflictException(e); } List<ServiceClient> serviceClients = serviceClientConverter .convertServiceClientDtos(serviceClientsByEndpoint); Collections.sort(serviceClients, serviceClientSortingComparator); return new ResponseEntity<>(serviceClients, HttpStatus.OK); } }
EndpointsApiController implements EndpointsApi { @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT_ACL')") public ResponseEntity<List<ServiceClient>> getEndpointServiceClients(String id) { Long endpointId = parseLongIdOrThrowNotFound(id); List<ServiceClientDto> serviceClientsByEndpoint; try { serviceClientsByEndpoint = serviceClientService.getServiceClientsByEndpoint(endpointId); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } catch (ClientNotFoundException e) { throw new ConflictException(e); } List<ServiceClient> serviceClients = serviceClientConverter .convertServiceClientDtos(serviceClientsByEndpoint); Collections.sort(serviceClients, serviceClientSortingComparator); return new ResponseEntity<>(serviceClients, HttpStatus.OK); } @Autowired  EndpointsApiController(
            EndpointService endpointService,
            EndpointConverter endpointConverter,
            AccessRightService accessRightService,
            ServiceClientConverter serviceClientConverter,
            ServiceClientHelper serviceClientHelper,
            ServiceClientService serviceClientService); }
EndpointsApiController implements EndpointsApi { @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT_ACL')") public ResponseEntity<List<ServiceClient>> getEndpointServiceClients(String id) { Long endpointId = parseLongIdOrThrowNotFound(id); List<ServiceClientDto> serviceClientsByEndpoint; try { serviceClientsByEndpoint = serviceClientService.getServiceClientsByEndpoint(endpointId); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } catch (ClientNotFoundException e) { throw new ConflictException(e); } List<ServiceClient> serviceClients = serviceClientConverter .convertServiceClientDtos(serviceClientsByEndpoint); Collections.sort(serviceClients, serviceClientSortingComparator); return new ResponseEntity<>(serviceClients, HttpStatus.OK); } @Autowired  EndpointsApiController(
            EndpointService endpointService,
            EndpointConverter endpointConverter,
            AccessRightService accessRightService,
            ServiceClientConverter serviceClientConverter,
            ServiceClientHelper serviceClientHelper,
            ServiceClientService serviceClientService); @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT')") ResponseEntity<Endpoint> getEndpoint(String id); @Override @PreAuthorize("hasAuthority('DELETE_ENDPOINT')") @AuditEventMethod(event = DELETE_REST_ENDPOINT) ResponseEntity<Void> deleteEndpoint(String id); @Override @PreAuthorize("hasAuthority('EDIT_OPENAPI3_ENDPOINT')") @AuditEventMethod(event = EDIT_REST_ENDPOINT) ResponseEntity<Endpoint> updateEndpoint(String id, EndpointUpdate endpointUpdate); @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT_ACL')") ResponseEntity<List<ServiceClient>> getEndpointServiceClients(String id); @Override @PreAuthorize("hasAuthority('EDIT_ENDPOINT_ACL')") ResponseEntity<List<ServiceClient>> addEndpointServiceClients(String id, ServiceClients serviceClients); @Override @PreAuthorize("hasAuthority('EDIT_ENDPOINT_ACL')") ResponseEntity<Void> deleteEndpointServiceClients(String id, ServiceClients serviceClients); }
EndpointsApiController implements EndpointsApi { @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT_ACL')") public ResponseEntity<List<ServiceClient>> getEndpointServiceClients(String id) { Long endpointId = parseLongIdOrThrowNotFound(id); List<ServiceClientDto> serviceClientsByEndpoint; try { serviceClientsByEndpoint = serviceClientService.getServiceClientsByEndpoint(endpointId); } catch (EndpointNotFoundException e) { throw new ResourceNotFoundException(NOT_FOUND_ERROR_MSG + " " + id); } catch (ClientNotFoundException e) { throw new ConflictException(e); } List<ServiceClient> serviceClients = serviceClientConverter .convertServiceClientDtos(serviceClientsByEndpoint); Collections.sort(serviceClients, serviceClientSortingComparator); return new ResponseEntity<>(serviceClients, HttpStatus.OK); } @Autowired  EndpointsApiController(
            EndpointService endpointService,
            EndpointConverter endpointConverter,
            AccessRightService accessRightService,
            ServiceClientConverter serviceClientConverter,
            ServiceClientHelper serviceClientHelper,
            ServiceClientService serviceClientService); @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT')") ResponseEntity<Endpoint> getEndpoint(String id); @Override @PreAuthorize("hasAuthority('DELETE_ENDPOINT')") @AuditEventMethod(event = DELETE_REST_ENDPOINT) ResponseEntity<Void> deleteEndpoint(String id); @Override @PreAuthorize("hasAuthority('EDIT_OPENAPI3_ENDPOINT')") @AuditEventMethod(event = EDIT_REST_ENDPOINT) ResponseEntity<Endpoint> updateEndpoint(String id, EndpointUpdate endpointUpdate); @Override @PreAuthorize("hasAuthority('VIEW_ENDPOINT_ACL')") ResponseEntity<List<ServiceClient>> getEndpointServiceClients(String id); @Override @PreAuthorize("hasAuthority('EDIT_ENDPOINT_ACL')") ResponseEntity<List<ServiceClient>> addEndpointServiceClients(String id, ServiceClients serviceClients); @Override @PreAuthorize("hasAuthority('EDIT_ENDPOINT_ACL')") ResponseEntity<Void> deleteEndpointServiceClients(String id, ServiceClients serviceClients);  }