1. 02 Oct, 2019 2 commits
    • Jérome Perrin's avatar
      Fix "incremental check" mode of consistency check alarm · 9a1cb966
      Jérome Perrin authored
      The way consistency check select documents to check at each run when running incremental mode, consistency seems to have issues which leads to documents not checked sometimes.
      
      I noticed two reasons:
      * When Zope runs with a timezone that is not `UTC`, the date comparison to find new documents compares a date in zope local timezone with a timestamp in mysql timezone. First fix is to pass a date to catalog, so that catalog convert it to the catalog timezone (it's a mistake to pass a date as string when using catalog programmatically). Second fix seem that we seem to need to configure mariadb to use `UTC` by default.
      * `alarm.getLastActiveProcess` does not return the latest active process when alarm is executing `activeSense` so we need to pass `include_active=True` in this case.
      
      /reviewed-on !537
      9a1cb966
    • Jérome Perrin's avatar
      Support properties' read permission in the GUI and in getProperty · 6c2435cf
      Jérome Perrin authored
      Because unlike `getFoo()`,  `getProperty('foo')` does not checks the permission defined on the accessor, when a form contain a `my_foo` field, the property would be displayed to the user who can view the form, even if the user does not actually have the permission to get this property. This because getter for default value of fields uses getProperty ( [here](https://lab.nexedi.com/nexedi/erp5/blob/58d4ab8efef748f522b3eaaecba3dc1133c99e72/product/ERP5Form/Form.py#L275) ).
      
      These changes modify behavior of `getProperty`, so that it enforces read permission security of properties and raise when user does not have permission to access properties.
      
      Some notes about implementation:
       * `getProperty` now becomes a bit slower, but it was incorrect before, so I guess it's inevitable.
       * some efforts have been made to keep the impact on performance minimal. This uses the same approach of  in `edit` of computing the set of restricted properties and using `guarded_getattr` only on these properties and using `getattr` on non-restricted properties. The computation of this set was moved  to dynamic class generation time and as a result, `edit` becomes a bit faster.
       * the `expectedFailure` part of `test_PropertySheetSecurityOnAccessors` was moved to another test, but I'm not even sure we want to support this (read-protecting properties with default write permission) as, to me, such configuration does not make much sense. 
       * new performance tests were added. I don't know what to use as min/max values so I just used something that should pass.
       * implementation for `getProperty('*_list')` was changed a lot, I have no idea why this was getting the method on the class and passing self as first argument. Now it we just get method on the instance, like we do for single properties.
      
      /reviewed-on nexedi/erp5!181
      6c2435cf
  2. 01 Oct, 2019 2 commits
  3. 30 Sep, 2019 10 commits
  4. 29 Sep, 2019 1 commit
  5. 27 Sep, 2019 10 commits
  6. 26 Sep, 2019 10 commits
  7. 25 Sep, 2019 5 commits