-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 
Author Message
 Post subject: Filtering data based on User profile - Data Level Security
PostPosted: Mon Aug 15, 2005 3:43 pm 
Newbie

Joined: Wed Jul 13, 2005 7:00 pm
Posts: 9
Hi,

We're trying to retrieve a set of data and filter the data based on the User profile. Each object that we retrieve has a hasPermission method which uses the object id and a set of security tables to return if the user has permission on that object or not.

Now, we're presently implementating a paging solution here where we retrieve 50 results everytime using setMaxResults() and we want to add the data level security on top of this. We want to retrieve a set of 50 records for which the user has access to.

Is there someway I can use interceptors in this scenario? I think the interceptor works after I get the 50 records. Then, if I put my logic in onLoad and onPostFlush and somehow filter the data, I will get the 50 - (Records with No access). Or Can filter be of some help in this scenario. My guess is that filters work like where classes.. so, I can filter the data based some data in that table or join tables.

Any pointers on this would be of great help.

Thanks in Advance.

Ravi.



Hibernate version: 3.0.5

Mapping documents:

Code between sessionFactory.openSession() and session.close():

Full stack trace of any exception that occurs:

Name and version of the database you are using:

The generated SQL (show_sql=true):

Debug level Hibernate log excerpt:


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 15, 2005 3:52 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Use a Hibernate3 filter.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 15, 2005 4:05 pm 
Newbie

Joined: Wed Jul 13, 2005 7:00 pm
Posts: 9
gavin wrote:
Use a Hibernate3 filter.


In the examples that I see, the filter is on a column that is part of the class (or collection).

like..
<class name="myClass" ...>
...
<filter name="myFilter" condition=":myFilterParam = MY_FILTERED_COLUMN"/>
</class>

or, to a collection:

<set ...>
<filter name="myFilter" condition=":myFilterParam = MY_FILTERED_COLUMN"/>
</set>

But, in our case, we want to use it like ":myFilterParam = returnObj.hasPermission()" instead of on a column of the class. I know this not straight forward from the DB point of view. like for each row, there is a logic that should retrieve data from other tables. Is this possible that I apply Hibernate3 filters based on this logic rather than on a column of the class?

Thanks,
Ravi.

P.S. Thanks Gavin, for that quick reply.


Top
 Profile  
 
 Post subject:
PostPosted: Mon Aug 15, 2005 4:07 pm 
Hibernate Team
Hibernate Team

Joined: Tue Aug 26, 2003 12:50 pm
Posts: 5130
Location: Melbourne, Australia
Sure, write a SQL user defined function.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.