Search in sources :

Example 51 with UserDTO

use of io.github.jhipster.sample.service.dto.UserDTO in project jhipster-sample-app-dto by jhipster.

the class UserResource method getAllUsers.

/**
 * GET /users : get all users.
 *
 * @param pageable the pagination information
 * @return the ResponseEntity with status 200 (OK) and with body all users
 */
@GetMapping("/users")
@Timed
public ResponseEntity<List<UserDTO>> getAllUsers(Pageable pageable) {
    final Page<UserDTO> page = userService.getAllManagedUsers(pageable);
    HttpHeaders headers = PaginationUtil.generatePaginationHttpHeaders(page, "/api/users");
    return new ResponseEntity<>(page.getContent(), headers, HttpStatus.OK);
}
Also used : HttpHeaders(org.springframework.http.HttpHeaders) ResponseEntity(org.springframework.http.ResponseEntity) UserDTO(io.github.jhipster.sample.service.dto.UserDTO) Timed(com.codahale.metrics.annotation.Timed)

Aggregations

UserDTO (io.github.jhipster.sample.service.dto.UserDTO)51 Test (org.junit.Test)44 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)44 User (io.github.jhipster.sample.domain.User)32 WithMockUser (org.springframework.security.test.context.support.WithMockUser)24 Transactional (org.springframework.transaction.annotation.Transactional)21 Authority (io.github.jhipster.sample.domain.Authority)7 Timed (com.codahale.metrics.annotation.Timed)6 AbstractCassandraTest (io.github.jhipster.sample.AbstractCassandraTest)6 PageRequest (org.springframework.data.domain.PageRequest)6 HttpHeaders (org.springframework.http.HttpHeaders)6 ResponseEntity (org.springframework.http.ResponseEntity)6 UsernamePasswordAuthenticationToken (org.springframework.security.authentication.UsernamePasswordAuthenticationToken)1 GrantedAuthority (org.springframework.security.core.GrantedAuthority)1 SimpleGrantedAuthority (org.springframework.security.core.authority.SimpleGrantedAuthority)1 OAuth2Authentication (org.springframework.security.oauth2.provider.OAuth2Authentication)1