Skip to content

Instantly share code, notes, and snippets.

@gregori
Created October 25, 2015 22:30
Show Gist options
  • Save gregori/2ed6f42b8459d8a198ad to your computer and use it in GitHub Desktop.
Save gregori/2ed6f42b8459d8a198ad to your computer and use it in GitHub Desktop.
Passo 3a
public interface PessoaRepository extends JpaRepository<Pessoa, Long> {
@Override
@PreAuthorize("hasRole('ROLE_ADMIN')")
Page<Pessoa> findAll(Pageable pageable);
@Override
@PostAuthorize("returnObject.nome == principal.username or hasRole('ROLE_ADMIN')")
Pessoa findOne(Long aLong);
@PreAuthorize("hasRole('ROLE_ADMIN')")
List<Pessoa> findByNomeLike(@Param("nome") String nome);
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment