0
我有一些控制器在我的Grails应用程序: -自定义链接
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
Config.groovy中,我提供我的CONFIGRATION之一: -
cirnelleControllerExclusions =['Login','Search','Searchable','Resource']
和main.gsp中,我使用: -
<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>
这个码被用于在每一个视图页面的顶部提供状结构的菜单,它是不包括4 cotroller s,我在Config.groovy中指定要在查看页面中显示为链接。 但我有很多用户都具有不同的角色就像
ROLE_PM
ROLE_SALES/BDM
ROLE_TEAMMEMBER
ROLE_ADMIN
,我的要求是,如果以管理员角色登录的用户,那么他就可以查看所有的控制器为纽带(除4),但如果与用户PM角色登录,则他无法查看CustomerController链接和QuotationCotroller链接。 那么我如何定制我的main.gsp来显示基于用户角色的菜单链接。 thnks