Posted By

lucastex on 03/18/09


Tagged

groovy grails acegi taglib


Versions (?)

Using the Acegi Taglib


 / Published in: HTML
 

  1. <g:isLoggedIn>
  2. Only logged users (no matter witch roles) will see this text. This is useful to build the "Welcome ..." text and the logout link!
  3. </g:isLoggedIn>
  4.  
  5. <g:isNotLoggedIn>
  6. Only anonymous users will see this. This is nice to build your "login" or "registration" link!
  7. </g:isNotLoggedIn>
  8.  
  9. <!-- Let's pretend we are logged as our 'god' user -->
  10. <g:loggedInUserInfo field="username"/> <!-- will show 'god' -->
  11. <g:loggedInUserInfo field="email"/> <!-- will show '[email protected]' -->
  12. <g:loggedInUserInfo field="userRealName"/> <!-- will show 'god almighty' -->
  13.  
  14. <g:ifAllGranted role="ROLE_ADMIN,ROLE_USER">
  15. This information will be available for admins whom have the ROLE_USER associated either.
  16. </g:ifAllGranted>
  17.  
  18. <g:ifAnyGranted role="ROLE_ADMIN,ROLE_USER">
  19. This information will be available for any logged admin or user.
  20. </g:ifAnyGranted>
  21.  
  22. <g:ifNotGranted role="ROLE_ADMIN">
  23. All sessions that have the ROLE_ADMIN associated will not see this message!
  24. </g:ifNotGranted>

Report this snippet  

You need to login to post a comment.