0

I want to display different menu according to login user . If user is client then display different menu otherwise show different menu.

I have one table User which is used to authenticate user , Client table which hold the userId as foreign key . Then how we determine whether user is client or not?

Another there is any way to add controller for menu?

4

1 回答 1

1

最好的方法之一是使用 Spring Security 插件。一旦设置(这很容易并且有很好的文档),您可以通过几种方式根据用户/角色控制内容:

  • 在控制器中 - 根据ifAllGraanted('ROLE_ADMIN')函数的输出将不同的菜单选项传递给视图
  • 直接在视图中 -<sec:ifAllGranted roles="ROLE_ADMIN">

更多信息在这里: http: //grails-plugins.github.com/grails-spring-security-core/docs/manual/guide/6%20Helper%20Classes.html

于 2011-12-15T09:15:39.960 回答