@Test public void listAppTest() throws Exception { this.mockMvc.perform( MockMvcRequestBuilders.get(ACCOUNT_APP_URL).header("Content-Type", "application/json").with(user)) .andExpect(MockMvcResultMatchers.status().is(HttpStatus.FORBIDDEN_403)); MvcResult andReturn = this.mockMvc.perform( MockMvcRequestBuilders.get(ACCOUNT_APP_URL).header("Content-Type", "application/json").with(admin)) .andExpect(MockMvcResultMatchers.status().is(HttpStatus.OK_200)).andReturn(); List<OadrAppDto> convertMvcResultToOadrUserDtoList = convertMvcResultToList(andReturn, appListRef); assertEquals(1, convertMvcResultToOadrUserDtoList.size()); assertEquals("app", convertMvcResultToOadrUserDtoList.get(0).getUsername()); }
@PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/app", method = RequestMethod.GET) @ResponseBody public List<OadrAppDto> listApp() { List<OadrApp> find = oadrAppService.findAll(); return dtoMapper.mapList(find, OadrAppDto.class); }
AccountController { @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/app", method = RequestMethod.GET) @ResponseBody public List<OadrAppDto> listApp() { List<OadrApp> find = oadrAppService.findAll(); return dtoMapper.mapList(find, OadrAppDto.class); } }
AccountController { @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/app", method = RequestMethod.GET) @ResponseBody public List<OadrAppDto> listApp() { List<OadrApp> find = oadrAppService.findAll(); return dtoMapper.mapList(find, OadrAppDto.class); }  }
AccountController { @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/app", method = RequestMethod.GET) @ResponseBody public List<OadrAppDto> listApp() { List<OadrApp> find = oadrAppService.findAll(); return dtoMapper.mapList(find, OadrAppDto.class); }  @RequestMapping(value = "/", method = RequestMethod.GET) @ResponseBody @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_DEVICE_MANAGER') or hasRole('ROLE_DRPROGRAM')") AbstractUserWithRoleDto registeredUser(Principal principal); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/user", method = RequestMethod.GET) @ResponseBody List<OadrUserDto> listUser(); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/user", method = RequestMethod.POST) @ResponseBody ResponseEntity<InputStreamResource> createUser(@RequestBody OadrUserCreateDto dto,
			HttpServletResponse response); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/user/{username}", method = RequestMethod.DELETE) @ResponseBody void deleteUser(@PathVariable("username") String username, HttpServletResponse response); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/app", method = RequestMethod.GET) @ResponseBody List<OadrAppDto> listApp(); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/app", method = RequestMethod.POST) @ResponseBody ResponseEntity<InputStreamResource> createApp(@RequestBody OadrAppCreateDto dto,
			HttpServletResponse response); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/app/{username}", method = RequestMethod.DELETE) @ResponseBody void deleteApp(@PathVariable("username") String username, HttpServletResponse response); }
AccountController { @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/app", method = RequestMethod.GET) @ResponseBody public List<OadrAppDto> listApp() { List<OadrApp> find = oadrAppService.findAll(); return dtoMapper.mapList(find, OadrAppDto.class); }  @RequestMapping(value = "/", method = RequestMethod.GET) @ResponseBody @PreAuthorize("hasRole('ROLE_ADMIN') or hasRole('ROLE_DEVICE_MANAGER') or hasRole('ROLE_DRPROGRAM')") AbstractUserWithRoleDto registeredUser(Principal principal); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/user", method = RequestMethod.GET) @ResponseBody List<OadrUserDto> listUser(); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/user", method = RequestMethod.POST) @ResponseBody ResponseEntity<InputStreamResource> createUser(@RequestBody OadrUserCreateDto dto,
			HttpServletResponse response); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/user/{username}", method = RequestMethod.DELETE) @ResponseBody void deleteUser(@PathVariable("username") String username, HttpServletResponse response); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/app", method = RequestMethod.GET) @ResponseBody List<OadrAppDto> listApp(); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/app", method = RequestMethod.POST) @ResponseBody ResponseEntity<InputStreamResource> createApp(@RequestBody OadrAppCreateDto dto,
			HttpServletResponse response); @PreAuthorize("hasRole('ROLE_ADMIN')") @RequestMapping(value = "/app/{username}", method = RequestMethod.DELETE) @ResponseBody void deleteApp(@PathVariable("username") String username, HttpServletResponse response);  }