java - Spring Data Rest: Return Resources of User -


i'm creating simple crud-app (a shoppinglist) spring boot , spring data rest. have resource: shoppingitem. there easy way return resources belong user send request? (multiple user support) user own shoppingitems , not every shoppingitem. or have implement controller myself, this?

i found spring data rest filtering data based on user approach filtering resources based on user, won't me repository endpoint.

thanks in advance

if using spring security integration can use acl (maybe heavy) or simple postfilter following:

public interface shoppingitemrepository extends crudrepository<shoppingitem, long> {     @postfilter("filterobject.user.getid() == principal.id")     @override     iterable<shoppingitem> findall();    } 

Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -