This content has been marked as final.
Show 4 replies
-
1. Re: Role-based authentication
monkeyden Feb 17, 2011 10:01 AM (in response to wadhah)Correct me if I'm wrong but I think you're talking about
authorization
by page, notauthentication
. -
2. Re: Role-based authentication
wadhah Feb 17, 2011 10:09 AM (in response to wadhah)
Kyle Burke wrote on Feb 17, 2011 10:01:
Correct me if I'm wrong but I think you're talking aboutauthorization
by page, notauthentication
.Yes authorization by page in fact i have 4 users : A,B,C,D. Each user after athentification should be redirected to a specific page switch the role ...
-
3. Re: Role-based authentication
monkeyden Feb 17, 2011 10:44 AM (in response to wadhah)So it's not even really authorization, it's role-based navigation, but you can do both in pages.xml.
You could do something like this:
Navigation:
<page view-id="/login.xhtml"> <navigation from-action="#{identity.login}"> <rule if="#{identity.hasRole('A')}"> <redirect view-id="/A-home.xhtml"/> </rule> <rule if="#{identity.hasRole('B')}"> <redirect view-id="/B-home.xhtml"/> </rule> ... </navigation> </page>
Authorization:
Then, for each of the role-specific pages (A-home.xhtml, B-home.xhtml), you can do this:
<page view-id="/A-home.xhtml"> <restrict>#{s:hasRole('A')}</restrict> ... </page> <page view-id="/B-home.xhtml"> <restrict>#{s:hasRole('B')}</restrict> ... </page>
-
4. Re: Role-based authentication
wadhah Feb 18, 2011 2:08 AM (in response to wadhah)
Kyle Burke wrote on Feb 17, 2011 10:44:
So it's not even really authorization, it's role-based navigation, but you can do both in pages.xml.
You could do something like this:
Navigation:<page view-id="/login.xhtml"> <navigation from-action="#{identity.login}"> <rule if="#{identity.hasRole('A')}"> <redirect view-id="/A-home.xhtml"/> </rule> <rule if="#{identity.hasRole('B')}"> <redirect view-id="/B-home.xhtml"/> </rule> ... </navigation> </page>
Authorization:
Then, for each of the role-specific pages (A-home.xhtml, B-home.xhtml), you can do this:<page view-id="/A-home.xhtml"> <restrict>#{s:hasRole('A')}</restrict> ... </page> <page view-id="/B-home.xhtml"> <restrict>#{s:hasRole('B')}</restrict> ... </page>
Thank u i just need the navigation it works perfectly thx ;)