Now, this is a little more tricky, as this requires us to change code at the service layer on the backend, but it is not hard. Let's get right to it.
Let's start with the product order entity. Let's modify the findAll method in src/main/java/com/mycompany/store/service/ProductOrderService.java as follows:
@Transactional(readOnly = true) public Page<ProductOrder> findAll(Pageable pageable) { log.debug("Request to get all ProductOrders"); if (SecurityUtils.isCurrentUserInRole(AuthoritiesConstants.ADMIN)) { return productOrderRepository.findAll(pageable); } else return productOrderRepository.findAllByCustomerUserLogin( SecurityUtils.getCurrentUserLogin().get(), pageable ); }
As you can see, we modified ...