I am using the <sec:access> tag in my layout to enable/disable menu options according to the user roles as follows
This works fine in development and when I produce a war file through STS.Code:<table style="width:350px;float:left;"> <tr> <sec:access expression="hasRole('ROLE_BUSINESS_ADMIN')"> <td class="menu_pipe">|</td> <td class="menu_group" id="fileMenu"><a><g:message code="menu.main.file" /></a></td> <td class="menu_pipe">|</td> </sec:access> <sec:access expression="hasRole('ROLE_USER')"> <td class="menu_group" id="dataflowsMenu"><a><g:message code="menu.main.dataflows" /></a></td> <td class="menu_pipe">|</td> </sec:access> <sec:access expression="hasRole('ROLE_BUSINESS_ADMIN')"> <td class="menu_group" id="optionsMenu"><a><g:message code="menu.main.options" /></a></td> <td class="menu_pipe">|</td> </sec:access> <sec:access expression="hasRole('ROLE_BUSINESS_ADMIN')"> <td class="menu_group" id="processingMenu"><a><g:message code="menu.main.processing" /></a></td> <td class="menu_pipe">|</td> </sec:access> <sec:access expression="hasRole('ROLE_USER')"> <td class="menu_group" id="validationMenu"><a><g:message code="menu.main.validation" /></a></td> <td class="menu_pipe">|</td> </sec:access> <sec:access expression="hasRole('ROLE_USER')"> <td class="menu_group" id="adminMenu"><a><g:message code="menu.main.administration" /></a></td> <td class="menu_pipe">|</td> </sec:access> </tr> </table>
However, when I build a war using the Grails war task and a custom 'build' environment in Hudson and deploy the war file to Tomcat, I am able to login successfully, but none of the menu options are visible.
Another item in the same page using the <sec:ifLoggedIn> tag is correctly enabled/disabled so I don't think that there is a problem with the Spring Security Core plugin generally.
Debug logging does not show any errors, so I have been unable to track down the problem.
Has anybody encountered a similar problem or is anybody aware of any problem with this tag and custom environments?
I am using STS 2.3.3.M2, Grails 1.3.1, Spring Security Core 1.0.1, Hudson Grails Plugin 1.3, Hudson 1.3.27.


Reply With Quote