This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new ba219c0205 Fixed: Can‘t run job when user changed password 
(OFBIZ-10573)
ba219c0205 is described below

commit ba219c02057f3b2485093797d9f02ba128bbc742
Author: Jacques Le Roux <jacques.le.r...@les7arts.com>
AuthorDate: Tue Feb 7 15:40:57 2023 +0100

    Fixed: Can‘t run job when user changed password (OFBIZ-10573)
    
    Assume an async job is created by an user. If this user changes h/is/er 
password
    before the job is run, an Auth exception is thrown
    
    Thanks: zhang.liang for report and Rohit Koushal for the fix suggested by 
Deepak
---
 .../main/java/org/apache/ofbiz/service/job/PersistedServiceJob.java  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git 
a/framework/service/src/main/java/org/apache/ofbiz/service/job/PersistedServiceJob.java
 
b/framework/service/src/main/java/org/apache/ofbiz/service/job/PersistedServiceJob.java
index c4f02e964b..0270ce9f3b 100644
--- 
a/framework/service/src/main/java/org/apache/ofbiz/service/job/PersistedServiceJob.java
+++ 
b/framework/service/src/main/java/org/apache/ofbiz/service/job/PersistedServiceJob.java
@@ -305,10 +305,15 @@ public class PersistedServiceJob extends 
GenericServiceJob {
             if (context == null) {
                 context = new HashMap<>();
             }
+
             // check the runAsUser
+            GenericValue userLogin = (GenericValue) context.get("userLogin");
             if (UtilValidate.isNotEmpty(jobValue.getString("runAsUser"))) {
                 context.put("userLogin", ServiceUtil.getUserLogin(getDctx(), 
context, jobValue.getString("runAsUser")));
+            } else if (userLogin != null) {
+                userLogin.refresh();
             }
+
         } catch (GenericEntityException e) {
             Debug.logError(e, "PersistedServiceJob.getContext(): Entity 
Exception", MODULE);
         } catch (SerializeException e) {

Reply via email to