I've a question about Grails (using version 2.3.7). I would like to save the username of the current logged in user (I'm using the spring security core plugin) to all my domains, so the user can only see/edit his own data if he logs in. To filter the content by user it is necessary to save the username with the data to the database.
I didn't find an example how to do this in an easy and appropriate way. It is not really necessary to add the username manually on every single Controller and in every method?? (save, edit etc.)
Thanks for any help, sbr
EDIT: What I need is something that is described here: http://www.javacodegeeks.com/2013/11/getting-started-with-method-security-in-grails-using-spring-security.html So I extended my Domain-Class with "static belongsTo = [author: User]" and the User-Class with "static hasMany = [notes: Note]". But now when I want to save a new Domain I receive the error that the author cannot be null. So HOW to fill this property with the current logged in user?