[ADMINCTR-70] Default timezone overwritten with GMT timezone when editing user profile Created: 23/May/22  Updated: 20/Jul/22  Resolved: 14/Jun/22

Status: Closed
Project: Admincentral
Component/s: None
Affects Version/s: 6.2.19
Fix Version/s: 6.2.20

Type: Bug Priority: Neutral
Reporter: Jonathan Ayala Assignee: Adam Siska
Resolution: Fixed Votes: 0
Labels: None
Σ Remaining Estimate: Not Specified Remaining Estimate: Not Specified
Σ Time Spent: 3.5h Time Spent: 3.5h
Σ Original Estimate: Not Specified Original Estimate: Not Specified

Attachments: XML File scripts.removeEmptyUserTimezones.xml    
Issue Links:
Problem/Incident
causality
caused by ADMINCTR-1 Migrate user preferences dialog to ne... Closed
Sub-Tasks:
Key
Summary
Type
Status
Assignee
ADMINCTR-116 Provide PR - Convert blank value fall... Sub-task Completed Adam Siska  
ADMINCTR-117 Code review Sub-task Closed Antonín Juran  
ADMINCTR-118 Preint QA Sub-task Closed Quach Hao Thien  
ADMINCTR-119 Integrate Sub-task Completed Adam Siska  
ADMINCTR-120 QA Sub-task Completed Antonín Juran  
ADMINCTR-127 Refix TimeZoneSelectFieldSupportTest#... Sub-task Completed Adam Siska  
Template:
Acceptance criteria:
Empty
Date of First Response:
Epic Link: Nucleus Quality Maintenance
Sprint: Nucleus 12
Story Points: 2
Team: Nucleus

 Description   

When editing a user without an explicitly configured timezone (defaults to server timezone), this one is overridden with GMT timezone when saving the user profile dialog.

 

Workarounds:

A. Use the old dialog (revert this change)

B. or remove empty timezone properties from users via a script scripts.removeEmptyUserTimezones.xml / update task.

import info.magnolia.context.MgnlContext
import info.magnolia.jcr.util.PropertyUtil

import javax.jcr.Node
import javax.jcr.Property
import javax.jcr.query.Query

session = MgnlContext.getJCRSession("users")
session.getWorkspace().getQueryManager()
        .createQuery("SELECT * FROM [mgnl:user] AS user WHERE ISDESCENDANTNODE('/admin') AND user.timezone IS NOT NULL", Query.JCR_SQL2)
        .execute()
        .nodes
        .forEachRemaining((Node node) -> {
            Property property = PropertyUtil.getPropertyOrNull(node, "timezone")
            if (property != null) {
                println "Removing " + property
                property.remove()
            }
        })
//session.save() //uncomment this when satisfied with list of properties to remove

 



 Comments   
Comment by Roman Kovařík [ 23/May/22 ]

Discovery:

The new implementation takes the old default user timezone value (empty string) and converts it to GMT 

Proposed solutions:

A. Filter blank value fallbacks to default timezone when presenting the timezone value

B. Or remove the empty timezone properties by an update task as suggested by the customer (this would not fix existing bootstrap files though)

 

Comment by Adam Jones [ 01/Jun/22 ]

Don't forget to add test coverage on affected area to protect against regression in future.

Comment by Adam Jones [ 01/Jun/22 ]

We are going with option A.

Generated at Sun Feb 11 23:03:44 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.