If you are using Grails Spring Security in your application, one killer functionality that we can easily provide is a simple user switcher
Add this to your admin layout:
<sec:ifAllGranted roles='ROLE_ADMIN'>
<form action='/j_spring_security_switch_user' method='POST'>
Switch: <g:select from="${users}" optionKey="username" optionValue="displayInfo"
name='j_username'/> <input type='submit' value='Switch'/>
</form>
</sec:ifAllGranted>
<sec:ifSwitched>
<a href='${request.contextPath}/j_spring_security_exit_user'>
Resume as <sec:switchedUserOriginalUsername/>
</a>
</sec:ifSwitched>
In Config.groovy, add the following:
grails.plugins.springsecurity.useSwitchUserFilter = true
So, in two easy steps we can provide the application admin to impersonate other users. This also checks if the current user is actually an impersonation and if it is, it provides a link to go back to the original user.
Very neat indeed
More detailed info available here
Regards
~~Himanshu Seth~~
http://www.IntelliGrape.com





