0
私はspring-security-coreプラグイン3.1.2でgrails 3.2.9を使用しています。grails 3スプリングセキュリティユーザドメインIDフィールド合成
s2-quickstartスクリプトを実行して、User、Role、およびUserRoleドメインクラスを作成しました。私は、UserおよびRoleドメインのidフィールドが合成と見なされていることを発見しました。ここで
def u = User.class.declaredFields.findAll {!it.synthetic}
u.each {
println it
}
は私のUserクラスである:私は次のコードのビットを実行している場合たとえば、idフィールドが示されていない
@GrailsCompileStatic
@EqualsAndHashCode(includes='username')
@ToString(includes='username', includeNames=true, includePackage=false)
class User extends BaseDomain implements Serializable {
private static final long serialVersionUID = 1
String username
String password
boolean enabled = true
boolean accountExpired
boolean accountLocked
boolean passwordExpired
Date lastLogin
Set<Role> getAuthorities() {
(UserRole.findAllByUser(this) as List<UserRole>)*.role as Set<Role>
}
static constraints = {
password blank: false, password: true
username blank: false, unique: true
}
static mapping = {
id generator: 'identity', column: 'user_id', sqlType: 'bigint(20) unsigned'
password column: '`password`'
lastLogin sqlType: 'timestamp'
}
}
これは私の他のドメインクラスで起きていない、と最初の問題は、これがexa-datatablesプラグイン(2.0.1)で起こっていることです。プラグインは同様のコードを使用してドメインのフィールドを検索するため、プラグインによって表示されるidフィールドを要求すると、未知の列エラーで失敗します。