Grails
  1. Grails
  2. GRAILS-8604

Dirty checking not working as expected in webflow, returns false when it should return true

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.3.7, 2.0 final
    • Fix Version/s: None
    • Component/s: Persistence, WebFlow
    • Labels:
    • Environment:
      Win7

      Description

      Hi

      While updating a password change webflow I noticed that the isDirty check on the password field returns false even though it has been updated.
      This is not great when using the spring-security-core plugin by default relies on the beforeUpdate event to encode the password.

      I've attached a simple example which has one normal action which works and one webflow which shows the problem.

      I've run the below test with both Grails 1.3.7 and 2.0.0, same issue exists in both versions.

      The BootStrap sets up one user with username test1 and the password password.

      URL Description
      http://
      localhost:8080/pwd-update-test/user/changepasswordAction
      normal action in which the isDirty check works and the encodePassword method is executed
      http://localhost:8080/pwd-update-test/user/changepassword webflow where the isDirty check returns false and the password property is persisted with the clear text password

      When running the webflow action I get the following output:

      pwdupdate.UserController flow password dirty? false
      pwdupdate.UserController flow user obj dirty? false
      pwdupdate.UserController <problem.pwdupdate.User@633cae19 springSecurityService=grails.plugins.springsecurity.SpringSecurityService@30646a81 username=test1 password=micke enabled=true accountExpired=false accountLocked=false passwordExpired=false errors=grails.validation.ValidationErrors: 0 errors id=1 version=4>
      

        Activity

        Show
        Mikael Andersson added a comment - Related grails-user mailing list post http://grails.1312388.n4.nabble.com/Dirty-checking-of-domain-field-inside-webflow-not-behaving-as-I-would-expect-returns-false-td4248124.html
        Hide
        Mihhail Verhovtsov added a comment -

        We had a similar problem with dirty checking, but not related to webflow. A domain object of class MyUser was obtained via MyUser.get(id). It was then modified. Additionally, in beforeUpdate() trigger a new "modifiedBy" was assigned. In some cases, the value of the property was the same a the domain object itself (meaning that a user modified itself). However, this modifier was obtained via MyUser.read(id). This set "dirty" to always being false and therefore myUser.save(flush: true) did not fire any updated. Perhaps, webflow is read()-ing object behind the scenes and this causes troubles?

        Show
        Mihhail Verhovtsov added a comment - We had a similar problem with dirty checking, but not related to webflow. A domain object of class MyUser was obtained via MyUser.get(id). It was then modified. Additionally, in beforeUpdate() trigger a new "modifiedBy" was assigned. In some cases, the value of the property was the same a the domain object itself (meaning that a user modified itself). However, this modifier was obtained via MyUser.read(id). This set "dirty" to always being false and therefore myUser.save(flush: true) did not fire any updated. Perhaps, webflow is read()-ing object behind the scenes and this causes troubles?

          People

          • Assignee:
            Unassigned
            Reporter:
            Mikael Andersson
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Last Reviewed:

              Development