Just use the rendered attribute + role checking in components, for example, for a submenu:
<p:submenu label="#{msg['header.management']}" rendered="#{request.isUserInRole('INTERNO')}"> <p:submenu label="#{msg['header.roles']}" icon="ui-icon-contact"> <p:menuitem value="#{msg['header.newRole']}" url="/pages/addRole.jsf" /> <p:menuitem value="#{msg['header.mngRoles']}" url="/pages/viewRole.jsf" /> </p:submenu>
Being the "INTERNO" role defined in Spring. I think it is quite elegant.
To disable navigation for this pafe (or set of pages), you still have to add a hook to your spring-security.xml , for example:
<intercept-url pattern="/pages/*Role*" access="hasRole('INTERNO')" />
source share