1. 19 Mar, 2019 3 commits
    • Jérome Perrin's avatar
    • Jérome Perrin's avatar
      ERP5Security: make ERP5AccessTokenExtractionPlugin work with user ids · c957099d
      Jérome Perrin authored
      Because this was broken, we took the liberty to introduce a breaking
      change to fix naming, now type based scripts are *_getUserValue and must
      return a user document, with a getUserId method returning the user id.
      
      Make this plugin also an IAuthenticationPlugin which does all the job of
      returning the user id.
      It does not really make sense to delegate this to default authenticator.
      A side effect is that token can still authenticate users with no
      assignments, since tokens are scriptable, if this is a requirement, it
      can be implemented in scripts.
      
      also update test:
      
       - plugin must be enabled for IAuthenticationPlugin
       - check complete authentication sequence, not just extraction
       - update scripts to new names
       - simplify transaction management
       - don't set self.person, it was not used anywhere
       - update _createPerson to reindex, as said in docstring
       - merge all tests in on test component
      c957099d
    • Jérome Perrin's avatar
      9c2719b0
  2. 14 Mar, 2019 13 commits
    • Xiaowu Zhang's avatar
      erp5_trade: drop caching method for resource list · f1bbc5aa
      Xiaowu Zhang authored
      benefit is very small and unusable for user
      
      1f254aa7
      f1bbc5aa
    • Vincent Pelletier's avatar
      Base._getAcquireLocalRoles: Optimise. · 213974eb
      Vincent Pelletier authored
      This is called when checking access permission on objects, which happens
      very often. CachingMethod has a hit cost which is too high for this use.
      Instead, generate this method as part of the portal type class, removing
      all call-time logic.
      213974eb
    • Vincent Pelletier's avatar
      all: Remove references to im_self. · 6b289998
      Vincent Pelletier authored
      It is superseded by __self__, which (where applicable) prevents
      acquisition and getattr-based traversal, improving performance.
      Patch AccessControl.users.BasicUser._check_context to extend this change
      to zope code (and simplify it in the process).
      Also, make __ac_local_roles__ accesses consistent with other places in
      our own code as well as in PAS & AccessControl.
      6b289998
    • Vincent Pelletier's avatar
      {,Propertied}User: Reduce the overhead from Developer role processing. · 240a8d26
      Vincent Pelletier authored
      getRoles is called a lot (on every restricted access, so hundreds of times
      per transaction), it is definitely not the right place to do extra
      computation, especially when their result does not change from one call
      to the next (configuration should only change on process restart, so not
      during a transaction - and even if it someday did, it should be fine to
      wait for next transaction for it to take effect).
      Instead, do the extra work when creating the user (typically once per
      transaction).
      Also, modernise python syntax (simplifications & style).
      Also, reduce code duplication from ERP5Security.ERP5UserFactory.
      240a8d26
    • Vincent Pelletier's avatar
      DCWorkflowDefinition_listObjectActions: Always return a vector. · e793b164
      Vincent Pelletier authored
      Simplifies callers, as they then do not have to test for None.
      Also, use sort(key=...), which removes the need for internal 2-tuple
      wrapping & unwrapping of all result entries.
      Also, coding style (helps line-based profiling readability) & better
      naming.
      e793b164
    • Vincent Pelletier's avatar
      WorkflowTool: Accelerate action generation. · bba23043
      Vincent Pelletier authored
      Include worklist parameter generation in the scope of existing cache.
      Otherwise, it will be generated in pure loss if it is followed by a cache
      hit. Most of WorkflowTool change is just indentation change.
      
      Also, do some minor optimisations/simplifications in patchess.DCWorkflow.
      Some comments:
      - Guard_checkWithoutRoles return value is evaluated as a boolean, so no
        need to cast to int before returning based on boolean evaluation...
      - DCWorkflowDefinition.worklists is always true, even when empty.
      - Listing portal types per workflow requires checking all workflows, so
        build the whole mapping and cache it instead of caching for each workflow
        type individually (many more cache hits, fewer redundant computations)
      - getVarMatch is expensive just for a fallback and a wrap, bypass it to
        reduce redundant work.
      bba23043
    • Vincent Pelletier's avatar
      ERP5Type.Core.Folder: Optimise _getFolderHandlerData. · 43dd2515
      Vincent Pelletier authored
      Backward-compatibility path does not need to be fast. Optimise for sane
      folders.
      43dd2515
    • Vincent Pelletier's avatar
      ERP5Type.Core.Folder: Do not try to access subobjects with invalid names. · 735d4748
      Vincent Pelletier authored
      This improves performance when unset protected properties are being
      accessed.
      735d4748
    • Arnaud Fontaine's avatar
    • Arnaud Fontaine's avatar
      erp5_base: Remove ParentDeliveryCategoryMovementGroup broken since its introduction apparently. · 1051b18f
      Arnaud Fontaine authored
      In contrary to the ParentDeliveryPropertyMovementGroup for property, it has
      never actually checked the parent Delivery but the current one.
      1051b18f
    • Arnaud Fontaine's avatar
      ui_dump_test: No need to track Activities. · 2c8fcf67
      Arnaud Fontaine authored
      This also avoids KeyError exceptions when Activities have already been processed
      in the meantime.
      2c8fcf67
    • Jérome Perrin's avatar
      ui_test_core: remove dead code · fcd4c826
      Jérome Perrin authored
      These extensions does not seem to be used.
      
      /reviewed-on nexedi/erp5!845
      fcd4c826
    • Jérome Perrin's avatar
      Repair testFunctionalStandaloneUserTutorial · ddd3e26c
      Jérome Perrin authored
      Test was never ending processing activities:
      
      ```
      2019-03-11T03:09:20 WARNING CMFActivity invalid after_path_and_method_id value: ('/erp5/organisation_module/2', 'immediateRecusriveReindexObject', 'immediateReindexObject')
      Traceback (most recent call last):
        File "product/CMFActivity/Activity/SQLBase.py", line 319, in getValidationSQL
          validate_list.append(' AND '.join(method(v, quote)))
        File "product/CMFActivity/Activity/SQLBase.py", line 345, in _validate_after_path_and_method_id
          path, method_id = value
      ValueError: too many values to unpack
      2019-03-11T03:09:20 WARNING CMFActivity invalid after_path_and_method_id value: ('/erp5/organisation_module/2', 'immediateRecusriveReindexObject', 'immediateReindexObject')
      Traceback (most recent call last):
        File "product/CMFActivity/Activity/SQLBase.py", line 319, in getValidationSQL
          validate_list.append(' AND '.join(method(v, quote)))
        File "product/CMFActivity/Activity/SQLBase.py", line 345, in _validate_after_path_and_method_id
          path, method_id = value
      ValueError: too many values to unpack
      2019-03-11T03:09:20 WARNING CMFActivity invalid after_path_and_method_id value: ('/erp5/organisation_module/2', 'immediateRecusriveReindexObject', 'immediateReindexObject')
      Traceback (most recent call last):
        File "product/CMFActivity/Activity/SQLBase.py", line 319, in getValidationSQL
          validate_list.append(' AND '.join(method(v, quote)))
        File "product/CMFActivity/Activity/SQLBase.py", line 345, in _validate_after_path_and_method_id
          path, method_id = value
      ValueError: too many values to unpack
      2019-03-11T03:09:20 ERROR CMFActivity message uid 7256619472683296857L has a circular dependency
       ```
      
      Fix this failing test by using the proper `after_path_and_method_id` syntax and also some other small changes to make the test fail earlier in case of problems.
      
      /reviewed-on nexedi/erp5!844
      ddd3e26c
  3. 13 Mar, 2019 4 commits
  4. 12 Mar, 2019 1 commit
  5. 11 Mar, 2019 4 commits
  6. 08 Mar, 2019 1 commit
    • Tristan Cavelier's avatar
      [erp5_web_renderjs_ui] fix changing relation field input state with empty value_text · 82c5ecae
      Tristan Cavelier authored
      Update relation field input value only on demand,
      changing the state of a relation_input gadget with value_text = ""
      now updates the field.
      
      You can reproduce by doing :
      - open an object in tab "View" with a relation field (eg my_successor_title) filled
      - open a new tab, and edit the field to make it empty
      - from the first tab, refresh the view by click on the left panel "View" tab
      - the relation field should be emptied.
      82c5ecae
  7. 07 Mar, 2019 9 commits
  8. 06 Mar, 2019 3 commits
  9. 05 Mar, 2019 2 commits
    • Sebastien Robin's avatar
      erp5.util: Release 0.4.58 · 59f55bfb
      Sebastien Robin authored
      59f55bfb
    • Sebastien Robin's avatar
      testnode: give time to supervisord to kill sub processes · 32c5eebf
      Sebastien Robin authored
      supervirord when stopping might need several seconds to kill
      properly sub processes. So give him some time before killing
      more brutaly with killall.
      
      This should solve issue with functional tests are not working
      due to apache not starting. Apache when killed to brutally
      let unclosed semaphore, and after some time, we have too many
      semaphore to start new apache, making functional tests failing.
      32c5eebf