You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@deltaspike.apache.org by Stan Ioan Eugen <me...@ieugen.ro> on 2014/08/10 01:13:23 UTC

deltaspike data seoft delete or filter by current user

Hello,

I'm working on a web service which uses deltaspike data and cxf to
expose a jax-rs service. My service needs to show data based on the
current user and I would like to hear your opinion on what is the best
approach to do this with deltaspike data.

I have my repository defined like this:

@Repository
@Transactional
public interface InvoiceRepository extends EntityRepository<Invoice, ID> {
}

I wish that when user A calls the service, my repository should list
only invoices that  he owns. The Invoice entity has a owner field
(links to the account, and to the user)

What is the best approach that I should use? I'm using Shiro for
security. My idea so far is to make a custom EntityRepository
implementation that will get the current user and filer (don't know
exactly how yet) by it.

I've searched for a solution to Spring Data [1], but it seems they
haven't implemented it yet. Are there plans for Deltaspike Data to
support such a feature?

Regards,

[1] https://jira.spring.io/browse/DATACMNS-293


-- 
Ioan Eugen Stan / ieugen.ro