[jbossseam-issues] [JBoss JIRA] Commented: (JBSEAM-2218) Re-evaluation of filter parameters for persistence contexts
Christian Bauer (JIRA)
jira-events at lists.jboss.org
Wed Nov 7 10:52:44 EST 2007
[ http://jira.jboss.com/jira/browse/JBSEAM-2218?page=comments#action_12386500 ]
Christian Bauer commented on JBSEAM-2218:
-----------------------------------------
Somewhat ugly workaround:
public class WikiManagedPersistenceContext extends ManagedPersistenceContext {
@Observer(value = {"User.loggedIn", "User.loggedInBasicHttp"}, create = false)
public void resetFilter() {
try {
PersistenceProvider persistenceProvider = PersistenceProvider.instance();
for (Filter f: getFilters())
{
if ( f.isFilterEnabled() )
{
persistenceProvider.enableFilter(f, getEntityManager());
}
}
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
}
> Re-evaluation of filter parameters for persistence contexts
> -----------------------------------------------------------
>
> Key: JBSEAM-2218
> URL: http://jira.jboss.com/jira/browse/JBSEAM-2218
> Project: JBoss Seam
> Issue Type: Feature Request
> Components: Core
> Reporter: Christian Bauer
> Priority: Minor
>
> I use a filter with a Seam-managed persistence context, the filter parameter is #{currentAccessLevel}. This expression is evaluated when the managed PC is created, in ManagedPersistenceContext.initEntityManager(). There is currently no way to re-evaluate that filter condition after the SMPC has been created. This leads to problems in the following scenario:
> - #{currentAccessLevel} = 0 when no user is logged in
> - #{currentAccessLevel} = 1000 when a user logs in (which requires database queries, so the SMPC is created)
> - certain backing beans observe the postAuthenticate event and refresh their state from the database, supposedly with the new #{currentAccessLevel} permission
> The backing beans that are called in postAuthenticate get the SMPC that was instantiated with #{currentAccesslevel} = 0.
> A relatively easy solution would be a new @Observer method on ManagedPersistenceContext and a new "org.jboss.seam.resetPersistenceContextFilterParameter" event I could call manually after authentication.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the seam-issues
mailing list