I have a domain class User defined as
class User extends SecUser{
String fullName
String address
String city
String country
String role
String email
String schoolName
String gradeLevel
static constraints = {
fullName(nullable:true)
username(blank:false, unique:true)
password(size:6..20, blank:false)
//passwordRepeat(validator:)
email(email:true, nullable:true, unique:true)
address(nullable:true)
city(nullable:true)
country(nullable:true)
phone(nullable:true) //10 digit phone number, no spaces
role(blank:false, inList:['Teacher', 'Donor', 'Both'])
schoolName(nullable:true)
gradeLevel(nullable:true, inList:['K', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', 'College'])
}
}
SecUser is a class implemented by executing the quickstart script of spring security grails plugin. Its defined as
class SecUser {
transient springSecurityService
String username
String password
boolean enabled
boolean accountExpired
boolean accountLocked
boolean passwordExpired
static constraints = {
username blank: false, unique: true
password blank: false
}
}
Normally, I thought the resulting database table would be a USER table with the listed fields above as columns, and I can use the UserController methods to implement CRUD. Problem is, the User table is never created, rather a SEC_USER table is instanciated witht he above fields.
My issue has to do with creating a new user and populating the relevant fields. Since the USER table doesn't exist, I can't insert records from the User domain object.
On the other hand, I can insert records in the SEC_USER table, but the fields are limited to those defined in the SecUser domain class. If I do try to insert an item in a particular column in User via a new SecUser instance, I get a property not defined error message.
This is somewhat frustrating, since in order to complete a user registration process, I need to access, insert and update the relevant fields, but how to do that with no access?