diff --git a/axonivy-express/src/ch/ivy/addon/portalkit/util/AdhocUtils.java b/axonivy-express/src/ch/ivy/addon/portalkit/util/AdhocUtils.java index 3d8d705..2a65575 100644 --- a/axonivy-express/src/ch/ivy/addon/portalkit/util/AdhocUtils.java +++ b/axonivy-express/src/ch/ivy/addon/portalkit/util/AdhocUtils.java @@ -10,6 +10,7 @@ import ch.ivy.gawfs.DynaFormController; import ch.ivy.gawfs.Formelement; import ch.ivyteam.ivy.environment.Ivy; +import ch.ivyteam.ivy.security.exec.Sudo; import ch.ivyteam.ivy.workflow.ICase; import gawfs.ExecutePredefinedWorkflowData; import gawfs.TaskDef; @@ -40,7 +41,7 @@ public static void storeHistory(long originalTaskId, String content) { } public static void attachToBusinessCase(final ICase icase, final Long businessCaseId) { - IvyExecutor.executeAsSystem(() -> { + Sudo.get(() -> { icase.attachToBusinessCase(businessCaseId); return null; }); diff --git a/axonivy-express/src/ch/ivy/addon/portalkit/util/ExecutingExpressProcessUtils.java b/axonivy-express/src/ch/ivy/addon/portalkit/util/ExecutingExpressProcessUtils.java index c12c764..02169e4 100644 --- a/axonivy-express/src/ch/ivy/addon/portalkit/util/ExecutingExpressProcessUtils.java +++ b/axonivy-express/src/ch/ivy/addon/portalkit/util/ExecutingExpressProcessUtils.java @@ -9,6 +9,7 @@ import ch.ivy.addon.portalkit.service.exception.PortalException; import ch.ivyteam.ivy.environment.Ivy; import ch.ivyteam.ivy.persistence.PersistencyException; +import ch.ivyteam.ivy.security.exec.Sudo; import ch.ivyteam.ivy.workflow.ICase; import ch.ivyteam.ivy.workflow.ITask; import ch.ivyteam.ivy.workflow.query.CaseQuery; @@ -21,7 +22,7 @@ private ExecutingExpressProcessUtils() {} @SuppressWarnings("unchecked") public static List getAttributesOfTasks(String groupId, String attribute) { - return IvyExecutor.executeAsSystem(() -> { + return Sudo.get(() -> { TaskQuery query = TaskQuery.create().where().caseId().isEqual(Ivy.wfCase().getId()).and().customField().textField(TASK_GROUP_ID_KEY) .isEqual(groupId).orderBy().endTimestamp(); @@ -40,7 +41,7 @@ public static List getAttributesOfTasks(String groupId, String attribute) @SuppressWarnings("unchecked") public static List getExpressTaskEndProcessData(Long caseId, String parentCategoryName) { - return IvyExecutor.executeAsSystem(() -> { + return Sudo.get(() -> { TaskQuery query = buildExpressTaskQuery(caseId, parentCategoryName); query.orderBy().endTimestamp(); List tasks = Ivy.wf().getTaskQueryExecutor().getResults(query); @@ -66,7 +67,7 @@ private static TaskQuery buildExpressTaskQuery(Long caseId, String parentCategor } public static ICase getExpressCase(long caseId) { - return IvyExecutor.executeAsSystem(() -> { + return Sudo.get(() -> { CaseQuery query = CaseQuery.businessCases().where().caseId().isEqual(caseId) .and().customField().stringField(CustomFields.IS_EXPRESS_PROCESS).isEqual("true"); List result = Ivy.wf().getCaseQueryExecutor().getResults(query); diff --git a/axonivy-express/src/ch/ivy/gawfs/mail/ExpressMailClient.java b/axonivy-express/src/ch/ivy/gawfs/mail/ExpressMailClient.java index c461667..e7c912f 100644 --- a/axonivy-express/src/ch/ivy/gawfs/mail/ExpressMailClient.java +++ b/axonivy-express/src/ch/ivy/gawfs/mail/ExpressMailClient.java @@ -10,7 +10,6 @@ import ch.ivy.addon.portalkit.bo.ExpressUserEmail; import ch.ivy.addon.portalkit.dto.ExpressAttachment; -import ch.ivy.addon.portalkit.util.IvyExecutor; import ch.ivyteam.ivy.environment.Ivy; import ch.ivyteam.ivy.mail.Attachment; import ch.ivyteam.ivy.mail.MailClient; @@ -19,11 +18,12 @@ import ch.ivyteam.ivy.mail.MailMessage; import ch.ivyteam.ivy.mail.MailMessage.Builder; import ch.ivyteam.ivy.scripting.objects.File; +import ch.ivyteam.ivy.security.exec.Sudo; public class ExpressMailClient { public static void send(ExpressUserEmail mail) { - IvyExecutor.executeAsSystem(() -> { + Sudo.get(() -> { MailMessage message = mapMailMessage(mail); MailClientConfig mailSetupConfig = getMailClientConfig();