Hi I am developing an application under Groovy using scafoldig. We are using the Acegi plugin for security. We have a class called ChangeManagement defined as follows (simplified version)
class ChangeManagement {
static constraints = {
company(nullable:false)
lastModifiedByUser(nullable:false)
}
Company company
static belongsToCompany = [company:Company]
User lastModifiedByUser
static belongsToUser = [lastModifiedByUser:User]
}
When I address the create method I will get a pull-down menu with the label "Last Modified By" with all the users from the table Users, which is the standard behaviour.
Instead of this I would like to have directly the user who is already logged in and no pull down menu. I've already generate the create template and I can modify it. I am assuming that I have to get the username from the session. If my assumption is true, how to get this username? and if I am wrong then from where can I get the username of the current user?
Thanks in advance.