-
Type: Bug
-
Status: Resolved
-
Priority: Minor
-
Resolution: Fixed
-
Affects Version/s: 2021.1
-
Component/s: Core
-
Release Notes Summary:Take into account the server timezone when updating ACEs.
-
Tags:
-
Backlog priority:750
-
Sprint:nxplatform #94
-
Story Points:3
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:
- an date-based ACE with a "begin" date is set, for example at 2023-08-01 00:00:00.000Z
- 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"
- 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
- session#setACP is called => it adds a "permission modified" event in the audit
- 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
- 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