cancel
Showing results for 
Search instead for 
Did you mean: 

show/hide Fields depending on role in a jsp

kwantm
Confirmed Champ
Confirmed Champ
hi,

Iam looking for a way to show/hide fields depending on the role your have while you are logged in.

For example. I would like to make the field "encoding" readonly in the jsp /jsp/content/add-content-dialog.jsp hen you are NOT an administrator.

i have tried the tag  <rSmiley TongueermissionEvaluator value="ROLE_ADMINISTRATOR" allow="ROLE_ADMINISTRATOR">, but that does not seem to be working.

is there anyone that could point me in the right direction?

@Extra info:
———————–
My problem is two fold. first i need to know which files I should edit in order to alter the edit content option in de web-client. I think I have found all files that do this.

The second part is to prevent NON administrator of having access to the encoding property. Only administrators may edit this. I have tried the following (using a booleanEvaluator):

<a:booleanEvaluator value="#{NavigationBean.currentUser.isAdmin}">
                                 <tr>
                                    <td></td>
                                    <td>
                                       <h:outputText id="text12" value="#{msg.encoding}:" />
                                    </td>
                                    <td>
                                       <h:selectOneMenu id="encoding" value="#{AddContentDialog.encoding}">
                                          <f:selectItems value="#{AddContentDialog.encodings}" />
                                       </h:selectOneMenu>
                                    </td>
                                 </tr>
                                 </a:booleanEvaluator>

But it seems to have no effect..

Anybody any idears if Iam looking in the right direction in solving my problem????



kind regards,

Marc
2 REPLIES 2

kevinr
Star Contributor
Star Contributor
The code is slightly wrong, you want:

value="#{NavigationBean.currentUser.admin == true}"

Kevin

kwantm
Confirmed Champ
Confirmed Champ
Hi,

Thnx for your information. I myself have added a extra metod (getAdministrator()) to achieve the required result, but this one is more elegant.

i will alter my code in this fahsion.


regards,

Marc