This is an automated email from the ASF dual-hosted git repository. jleroux pushed a commit to branch release22.01 in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release22.01 by this push: new 6976414e6b Fixed: Can‘t run job when user changed password (OFBIZ-10573) 6976414e6b is described below commit 6976414e6bad8c9b40cbf597e0a61721d8271cf5 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) {