I am starting a web app project using JSF 2.0 and PrimeFaces. One of the requirements would be to display different page content based on the user role. E.g. only admins should see the menu item – User administration.
Security-wise I will go for Spring security.
How could this be achieved in an elegant way? Should I make a xhtml template for everyone and then create different pages for each role with the role-specific UI items?
Thank you
Simply use the attribute
rendered+ role check in components, for example for a submenu:Being ‘INTERNO’ the role defined in Spring. I think this is pretty elegant.
To disable navigation for that pafe (or set of pages) you would still have to add an intercept to your
spring-security.xmlfor example: