如何在GORM视图中隐藏password列:

我的域类:
class SecUser {
static scaffold = true
transient springSecurityService
String username
String password
boolean enabled = true
boolean accountExpired
boolean accountLocked
boolean passwordExpired
static transients = ['springSecurityService']
static constraints = {
username blank: false, unique: true
password (display:false, blank: false)
}
static mapping = {
password column: '`password`'
}
Set<SecRole> getAuthorities() {
SecUserSecRole.findAllBySecUser(this).collect { it.secRole } as Set
}
def beforeInsert() {
encodePassword()
}
def beforeUpdate() {
if (isDirty('password')) {
encodePassword()
}
}
protected void encodePassword() {
password = springSecurityService.encodePassword(password)
// password = password
}
}发布于 2014-10-08 23:38:48
display: false约束用于在默认搭建的视图中隐藏属性。https://github.com/jeffbrown/scaffolddisplay的项目证明了这一点。你的应用程序中一定有什么东西阻碍了这一点。您可能已经生成了包含该属性的视图。您可能正在使用提供视图的插件。
https://stackoverflow.com/questions/26259938
复制相似问题