-
1. Re: Redirect based on identity-roles
pmuir Aug 1, 2007 7:07 AM (in response to uke)Sounds like you are on the right track. Post what you have, and see if someone can help you where you are going wrong.
-
2. Re: Redirect based on identity-roles
norman.richards Aug 2, 2007 1:17 PM (in response to uke)The DVDStore does something like that:
<navigation from-action="#{identity.login}"> <rule if="#{currentUser.admin}"> <redirect view-id="/admin/admin.xhtml"/> </rule> </navigation>
I should probably update that rule to be #{s:hasRole('admin')}, but it's the same thing. -
3. Re: Redirect based on identity-roles
uke Aug 3, 2007 3:51 AM (in response to uke)Thanks for your replies.
That's very similar to what I tried. Could you specify what the main difference is between these approaches?
This following code gives me a "Functions not supported in expressions."-error..<page view-id="/login.xhtml"> <navigation> <rule if="#{s:hasRole('ADMIN')}"> <redirect view-id="/viewStatus.xhtml"/> </rule> </navigation> </page>
-
4. Re: Redirect based on identity-roles
pmuir Aug 3, 2007 5:42 AM (in response to uke)What version of Seam (IIRC this was fixed recently)
-
5. Re: Redirect based on identity-roles
uke Aug 3, 2007 6:07 AM (in response to uke)Sorry about that. I should've mentioned that from the start.
It's 1.2.1 GA -
6. Re: Redirect based on identity-roles
pmuir Aug 3, 2007 6:13 AM (in response to uke)This was fixed after 1.2.1.GA
-
7. Re: Redirect based on identity-roles
uke Aug 3, 2007 6:56 AM (in response to uke)Is there a possible work-around, or should I start digging into the world of version-migrating? :)
Perhaps there is a way to get identity.login to return the view-id that I want to be redirected to? -
8. Re: Redirect based on identity-roles
pmuir Aug 3, 2007 7:47 AM (in response to uke)You can certainly work around in desgin, but there is no way to get functions working in pages.xml without patching Seam.
-
9. Re: Redirect based on identity-roles
lsabin Dec 14, 2007 1:57 PM (in response to uke)Hi.
I am having problems with the suggested solution. 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> <rule if="#{s:hasRole('admin')}"> <redirect view-id="/home.xhtml"/> </rule> </navigation>
The first time the user with role 'user' logs it gets redirected to the home.xhtml page. But if I logout and log in again it works and redirects to details.xhtml.
Could someone explain this behaviour?
Thanks. -
10. Re: Redirect based on identity-roles
pmuir Dec 18, 2007 4:32 PM (in response to uke)Start a new topic, nothing to do with this one.