4 Replies Latest reply on Jan 12, 2008 2:32 AM by Milli Coelho

    redirect based on roles

    leandro sabin Newbie


      In my application after the user logs in I want to redirect to a different page based on the user role. This is the relevant portion of my pages.xml:

       <navigation from-action="#{identity.login}">
       <rule if="#{s:hasRole('user')}">
       <redirect view-id="/details.xhtml"/>
       <rule if="#{s:hasRole('admin')}">
       <redirect view-id="/home.xhtml"/>

      The first time the user with role 'user' logs in this navigation rule does not work and the user gets redirected to the home.xhtml page. But if I logout and log in again it works fine and redirects to details.xhtml.

      Could someone explain this behaviour?