views:

247

answers:

2

I find that the tag <sec:IfAnyGranted roles="ROLE_ADMIN" > is ignored and on the .xhtml page I am getting following message.

The attribute **roles** is not defined in Component's interface

Thanks for the help in advance.
Reply With Quote

+1  A: 

Donal,

the standard spring security taglib does not work with JSF.

You can use the facelets version from http://www.ohloh.net/p/spring-security-facelets-taglib.

Then you can use the sec:ifAnyGranted() function (not tag) inside an expression:

 <p:menubar xmlns="http://www.w3.org/1999/xhtml"
  xmlns:p="http://primefaces.prime.com.tr/ui"
  xmlns:sec="http://www.springframework.org/security/facelets/tags"&gt;
...
<p:submenu label="#{msgs['menu.report']}" 
                    rendered="#{sec:ifAnyGranted('ROLE_ADMIN, ROLE_REPORTER')}">

This is a piece of working code that shows a menu only for the given use. Note that I do not use the default spring JSP taglib (http://www.springframework.org/security/tags) but the facelets version.

Regards, Dominik

Designpattern
A: 

This code is losting link but when log in with role_admin, link no see

yusuf