I have some controllers in my grails application:-
LoginController
LogoutController
SearchableController
cirnele.SearchAllController
com.ten.cirnelle.domain.CustomerController
com.ten.cirnelle.domain.ProjectController
com.ten.cirnelle.domain.PurchaseOrderController
com.ten.cirnelle.domain.QuotationController
com.ten.cirnelle.domain.ResourceController
In Config.groovy, I have provided one of my configration:-
cirnelleControllerExclusions =['Login','Search','Searchable','Resource']
and from main.gsp, I am using:-
<g:each var="c" in="${grailsApplication.controllerClasses.sort { it.fullName } }">
<g:if test="${grailsApplication.config.cirnelleControllerExclusions.contains(c.naturalName.split()[0]) == false}">
<li class="controller"><g:link controller="${c.logicalPropertyName}">${c.naturalName.split()[0]}</g:link></li>
</g:if>
</g:each>
this code is used to provide a menu like structure at the top of every view page and it is excluding 4 cotrollers, that i specified in Config.groovy to be display as a link in view pages.
but i have many users with different roles like
ROLE_PM
ROLE_SALES/BDM
ROLE_TEAMMEMBER
ROLE_ADMIN
and my requirement is that if an user with admin role logins, then he can view all the controllers as a link(except the 4) but if a user with PM role logins, then he cannot view CustomerController link and QuotationCotroller link.
so how can i customized my main.gsp to show menu links based on the role of user.
thnks
Try to use spring security plugin. There are tags for doing exactly what you want.