Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-32013

Fix inconsistency with the dates used by the date-based ACEs

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2021.1
    • Fix Version/s: 2023.1, 2021.42
    • Component/s: Core
    • Release Notes Summary:
      Take into account the server timezone when updating ACEs.
    • Backlog priority:
      750
    • Sprint:
      nxplatform #94
    • Story Points:
      3

      Description

      ACE#getStatus defines a date variable in UTC

      Calendar now = new GregorianCalendar(); 

      whereas UpdateACEStatusWork#work defines a date with a timezone

              String formattedDate = FORMATTER.format(ZonedDateTime.now());
      

      Analysis of the problem:

      1. an date-based ACE with a "begin" date is set, for example at 2023-08-01 00:00:00.000Z
      2. UpdateACEStatusWork#work is triggered and it computes a formattedDate with FORMATTER.format(ZonedDateTime.now()) => it builds a date based on the current timezone, for example at minight local time CEST, it will be "2023-08-01 00:00:00" whereas the UTC date is still "2023-07-31 22:00:00"
      3. session.queryAndFetch will find the previously defined ACE because the dates match => this is incorrect because the current time is not 00:00:00.000Z
      4. session#setACP is called => it adds a "permission modified" event in the audit
      5. but ACE#getStatus will return PENDING and the ACE will not be effective: because the current time is still before the begin date set on the ACE
      6. at the end, fireACEStatusUpdatedEvent is called too and sends a notification that the ACE is not effective whereas it is not

      Solution:

      the formattedDate should be computed in UTC to match the timezone used to save the dates in the database

      Workaround:

      Add -Duser.timezone=GMT to JAVA_OPTS in nuxeo.conf

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: