I've multiple different type users in my application, each type has it own role (and obviously authorities)
I want to use spring data rest but this functionnality must be possible for the ADMIN_ROLE user only.
I've then created 2 Repositories for each entity, one for the admin and the other for the rest of the users:
@RepositoryRestResource(exported = false)
public interface MenuRepository extends JpaRepository<Menu, Integer> {
}
// -------------------------------------------------------------------
@RepositoryRestResource
@PreAuthorize("hasRole('ROLE_ADMIN')")
public @interface AdminRestRepository {
}
// -------------------------------------------------------------------
@AdminRestRepository
public interface AdminMenuRestRepository extends JpaRepository<Menu, Integer> {
}
The problem is that once i start the application, sometimes the repository is exported and some other time it's not... any clue ?