-
1. Re: identity.addRole returns false and does not create role
guy_cole Apr 1, 2009 12:11 PM (in response to guy_cole)I forgot to mention that I am using Seam 2.1.1.GA
Thanks again.
-
2. Re: identity.addRole returns false and does not create role
scatudal Apr 1, 2009 8:42 PM (in response to guy_cole)This method is not meant to create a role. It simply adds this role to the current principal so that true is returned when the method hasRole('test') is called.
Example :
Let's say you have a page '/test.xhtml' that requires the role test. You would add a similar block in your '/web-inf/page.xml' file.
<page view-id="/test.xhtml"> <restrict>#{s:hasRole('test')}</restrict> </page>
So in your authenticate method, once you have validated the credentials, you would do something like this :
identity.addRole('test');
If I remember well, the authenticate method called by default adds the 'admin' role when you log in using the 'admin' username.
-
3. Re: identity.addRole returns false and does not create role
guy_cole Apr 1, 2009 9:56 PM (in response to guy_cole)Thanks for the advice.
I just got the Seam sources this morning. It seems the only way to return false is for an empty/null role string or the Principal is null.
Still haven't got it working but I hope I am on the way.
Amazingly, almost none of the examples use roles.
-
4. Re: identity.addRole returns false and does not create role
shane.bryzak Apr 1, 2009 10:54 PM (in response to guy_cole)This method is explained clearly in the docs:
http://docs.jboss.com/seam/2.1.1.GA/reference/en-US/html/security.html#d0e8507