How can I hide some content based on user role in JSF?
I'm using JAAS and have applied security on some fol开发者_Go百科ders for different roles. I want to hide some navigation for different users because, although the pages are not accessible, the user can still see the links that he has no rights on? What's the simple way to achieve this in JSF? Do I need to call a method to check the role in the "rendered" property of each navigation link? Any sample code? Please help!
Use rendered
for view, take
rendered="#{userBean.role =='ADMIN'}"
also configure filter or use Spring security's filter to restrict them to access the URL
The corrent answer is here, may be helpful for someone else: Is "isUserInRole" method related to JAAS?
精彩评论