[jboss-user] [JBoss Seam] - Re: identity.hasRole problem

anescu do-not-reply at jboss.com
Mon May 14 08:58:33 EDT 2007


Ok, now I'm really confused!

So, now i've tried the following:
In the authenticator class

public boolean authenticate()
  | {
  | ...
  | 	Identity.instance().addRole( new String( "account_admin" ) );
  | ...
  | 	System.out.println( "### account_admin: " + Identity.instance().hasRole( new String( "account_admin" ) ) );
  | ...
  | }

and in another class:

@In( required = false )
  | Identity 			identity;
  | ...
  | 
  | public Collection getValues()
  | {
  | 	System.out.println( "### again account_admin: " + identity.hasRole( new String( "account_admin" ) ) );
  | }
 The method is called to populate a select box on the interface.

So, in the first class, the answer is false, and in the second the answer is true. How can this be possible? I need to be able to load some objects based on the roles of the user, I suppose the best way to do this is from the authentication method, but apparently I can't, because of the result I get. Anyone knows if I'm missing something, or if this is a known bug?

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4045442#4045442

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4045442



More information about the jboss-user mailing list