|
[
Permalink
| « Hide
]
Graham Bakay added a comment - 19/Aug/08 10:58 AM
Ooo. That would be pretty cool. I'll see if I can't figure out the Grails event lifecycle (I imagine it's Spring-like) so we could add something like this. If you have any ideas (or code) Nick, please let me know.
Nick, you could possibly achieve this using a filter (ie without requiring changes to the plugin). Create a class called ApplicationFilters in grails-app\conf:
import org.codehaus.grails.plugins.crowd.util.CrowdAuthUtils class ApplicationFilters { def dependsOn = [crowd:0.3] def filters = { saveUser(controller:'*', action:'*') { after = { if (CrowdAuthUtils.isAuthenticated(request)) { if (!session.usersaved) { println 'saving user' session.usersaved = true } } } } } } Of course, I'm thinking you'll be doing something other than println 'saving user' There still might be a more elegant solution to this problem – using a session variable to track whether the user has been saved or not may be a little uncool, plus, I'm not loving having to put the version of the crowd plugin in dependsOn. |
||||||||||||||||||||||||||||||||||||||||||