Bootstrap issue with Acegi
Hi All,
I am new to grails and came across this bootstrap issue with grails 1.0 and grails-acegi-0.2. The User object(s) in bootstrap fails to save on initialization but rest of the objects saves ok, not sure if there is anything wrong with code, I cannot see any errors even with hibernate, spring and acegi logging turned on. Details follow,
We have a plugin generated acegi classes out of which, User class looks like:
class User {
static transients = ["pass"]
static hasMany=[authorities:Role]
static belongsTo = Role
/** Username */
String username
/** User Real Name*/
String userRealName
/** MD5 Password */
String passwd
/** enabled */
boolean enabled = false
String email
boolean email_show = false
/** description */
String description
/** plain password to create a MD5 password */
String pass="[secret]"
static def constraints = {
username(blank:false,unique:true)
passwd(blank:false)
enabled()
}
}
and the bootstrap class looks like,
import org.apache.commons.codec.digest.DigestUtils as DU
class BootStrap {
def init = { servletContext ->
def pass = DU.md5Hex("pass")
new User(username:"god",passwd:pass,enabled:true).save()
new User(username:"admin",passwd:pass,enabled:true).save()
new Role(username:"god",description:"Superuser",authority:"ROLE_SUPERUSER").save()
new Role(username:"admin",description:"Administrator",authority:"ROLE_ADMINISTRATOR").save()
new Requestmap(url:"/captcha/**",configAttribute:"ROLE_SUPERUSER").save()
new Requestmap(url:"/register/**",configAttribute:"ROLE_ADMINISTRATOR").save()
}
def destroy = {
}
}
Please help :)