Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JSF and role-based security  RSS feed

 
Yuri Sforza
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to make rendering of standard JSF html components role-dependent? Smth like disabling input for some fields in the form for some roles.
[ March 04, 2004: Message edited by: Yuri Sforza ]
 
Bill Dudney
Author
Ranch Hand
Posts: 234
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is a great question. I've not tried it myself but I expect you could do something like this
<h:commandButton ... id="1" rendered=#{securityBean.shouldRender["1"]} .../>
In the shouldRender method calculate the boolean value for each control and populate a map with these values. Then return the map. The EL stuff will evaluate it see true/false and the button will be rendered or not.
As I said I've not tried this and its a bit of a kludge since now the component knows its id as well as the security bean (info in two places is an invitation for bugs...). But I'm fairly sure this would work as a first approximation. I'll try to cook up an example and post it to my blog in the next couple of weeks.
 
Yuri Sforza
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. Seems to be enough direction to start experimenting.
Will also check your example when ready.
--
Y. Sforza
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!