This content has been marked as final.
Show 10 replies
-
1. Re: How do I select an initial page after login chosen by us
fernando_jmt Mar 15, 2007 7:30 PM (in response to zzztimbo)One idea could be to extend the Identity class in order to return a custom outcome (public String login()) based in your roles and then use it in the pages.xml.
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4028556 -
2. Re: How do I select an initial page after login chosen by us
shane.bryzak Mar 15, 2007 8:47 PM (in response to zzztimbo)If the users have one role only, you could write it like this:
<page view-id="/login.xhtml"> <navigation from-action="#{identity.login}"> <rule if="#{s:hasRole('user')"> <redirect view-id="/user.xhtml"/> </rule> <rule if="#{s:hasRole('poweruser')"> <redirect view-id="/poweruser.xhtml"/> </rule> </navigation> </page>
-
3. Re: How do I select an initial page after login chosen by us
zzztimbo Mar 15, 2007 8:56 PM (in response to zzztimbo)what about the
<rule if-outcome="loggedIn">
portion of the logic? if the user is already logged in and they try to go to the login screen, it should send them to the appropriate page: either user or poweruser. -
4. Re: How do I select an initial page after login chosen by us
shane.bryzak Mar 15, 2007 9:56 PM (in response to zzztimbo)If the user has either of those roles then it means they will be logged in, there is no need to check for it explicitly.
-
5. Re: How do I select an initial page after login chosen by us
gavin.king Mar 15, 2007 10:21 PM (in response to zzztimbo)The best option is:
<rule if="#{identity.loggedIn}">
No need for any special changes to Identity. -
6. Re: How do I select an initial page after login chosen by us
gavin.king Mar 15, 2007 10:22 PM (in response to zzztimbo)Oh, oops, I misunderstood.
-
7. Re: How do I select an initial page after login chosen by us
zzztimbo Mar 19, 2007 11:54 AM (in response to zzztimbo)"gavin.king@jboss.com" wrote:
The best option is:<rule if="#{identity.loggedIn}">
No need for any special changes to Identity.
What should the behavior be for this:<page view-id="/home.xhtml"> <navigation> <rule if="#{identity.loggedIn}"> <redirect view-id="/main.xhtml"/> </rule> </navigation> </page>
I copied this from the pages.xml of the booking example.
After I log in from home.seam, I get taken to main.seam. This is to be expected. When I explicitly go back to home.seam, should it redirect me again to main.seam? The current behavior I am getting is that it just sits there at home.seam. Logging in again of course works and takes me appropriately to main.seam. -
8. Re: How do I select an initial page after login chosen by us
zzztimbo Mar 19, 2007 12:21 PM (in response to zzztimbo)"shane.bryzak@jboss.com" wrote:
If the users have one role only, you could write it like this:<page view-id="/login.xhtml"> <navigation from-action="#{identity.login}"> <rule if="#{s:hasRole('user')"> <redirect view-id="/user.xhtml"/> </rule> <rule if="#{s:hasRole('poweruser')"> <redirect view-id="/poweruser.xhtml"/> </rule> </navigation> </page>
I'm getting an exception.javax.faces.el.EvaluationException: Cannot get value for expression '#{s:hasRole('user')}'
This syntax works fine when I restrict page access using:<page view-id="/user.xhtml"> <restrict>#{s:hasRole('user') or s:hasRole('admin')}</restrict> </page>
-
9. Re: How do I select an initial page after login chosen by us
shane.bryzak Mar 19, 2007 8:19 PM (in response to zzztimbo)This is a bug with MyFaces not supporting EL Functions. We're currently working on a solution, please hold :)
-
10. Re: How do I select an initial page after login chosen by us
shane.bryzak Mar 19, 2007 8:57 PM (in response to zzztimbo)No easy fix I'm afraid.
http://jira.jboss.com/jira/browse/JBSEAM-1079