Grails脚手架隐藏表柱

时间:2014-10-08 14:50:31

标签: grails hide scaffold

如何在GORM视图中隐藏password列: enter image description here

我的域名类:

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
    }
}

1 个答案:

答案 0 :(得分:2)

display: false约束用于从默认的scaffolded视图中隐藏属性。 https://github.com/jeffbrown/scaffolddisplay项目证明了这一点。您的应用中必须有一些东西阻碍了它。可能您生成了包含该属性的视图。可能你正在使用提供视图的插件。