From 952ac436afd1e85ce989a50c5b20d7bd9a675e7e Mon Sep 17 00:00:00 2001 From: Heng Sin Low Date: Fri, 9 Jun 2017 15:48:08 +0800 Subject: [PATCH] IDEMPIERE-3350 Accounting Processor GL postings to "secondary" schema unreliable. Caching of report tree ( organization tree, product tree, etc ) by tenant is not safe - due to access right of user+role, each combination of user+role might get a different report tree. --- .../src/org/compiere/report/MReportTree.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/report/MReportTree.java b/org.adempiere.base/src/org/compiere/report/MReportTree.java index 467182c99a..2dcc96a4fc 100644 --- a/org.adempiere.base/src/org/compiere/report/MReportTree.java +++ b/org.adempiere.base/src/org/compiere/report/MReportTree.java @@ -26,6 +26,7 @@ import java.util.logging.Level; import org.compiere.model.MAcctSchemaElement; import org.compiere.model.MHierarchy; +import org.compiere.model.MRole; import org.compiere.model.MTree; import org.compiere.model.MTreeNode; import org.compiere.util.CCache; @@ -49,8 +50,14 @@ public class MReportTree * @return tree */ public static MReportTree get (Properties ctx, int PA_Hierarchy_ID, String ElementType) - { - String key = Env.getAD_Client_ID(ctx) + "_" + PA_Hierarchy_ID + ElementType; + { + MRole role = MRole.getDefault(); + String key = Env.getAD_Client_ID(ctx) + "_" + role.getAD_Role_ID() + "_" + PA_Hierarchy_ID + "_" + ElementType; + if (!role.isAccessAllOrgs() && role.isUseUserOrgAccess() ) + { + key = Env.getAD_Client_ID(ctx) + "_" + Env.getAD_User_ID(ctx) + "_" + role.getAD_Role_ID() + "_" + PA_Hierarchy_ID + "_" + ElementType; + } + MReportTree tree = (MReportTree)s_trees.get(key); if (tree == null) {