From e32f9715872a44ee47e9b0962ad13922d7c37fc3 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud <58596990+nmicoud@users.noreply.github.com> Date: Thu, 28 Jan 2021 12:42:00 +0100 Subject: [PATCH] IDEMPIERE-4677 : Cross Tenant issues with AD_User/Role_OrgAccess (#556) --- org.adempiere.base/src/org/compiere/model/MRole.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MRole.java b/org.adempiere.base/src/org/compiere/model/MRole.java index 635b0dc916..b8f26b5217 100644 --- a/org.adempiere.base/src/org/compiere/model/MRole.java +++ b/org.adempiere.base/src/org/compiere/model/MRole.java @@ -814,11 +814,12 @@ public final class MRole extends X_AD_Role implements ImmutablePOSupport PreparedStatement pstmt = null; ResultSet rs = null; String sql = "SELECT * FROM AD_User_OrgAccess " - + "WHERE AD_User_ID=? AND IsActive='Y'"; + + "WHERE AD_User_ID=? AND IsActive='Y' AND AD_Client_ID = ?"; try { pstmt = DB.prepareStatement(sql, get_TrxName()); pstmt.setInt(1, getAD_User_ID()); + pstmt.setInt(2, Env.getAD_Client_ID(getCtx())); rs = pstmt.executeQuery(); while (rs.next()) { @@ -845,11 +846,12 @@ public final class MRole extends X_AD_Role implements ImmutablePOSupport PreparedStatement pstmt = null; ResultSet rs = null; String sql = "SELECT * FROM AD_Role_OrgAccess " - + "WHERE AD_Role_ID=? AND IsActive='Y'"; + + "WHERE AD_Role_ID=? AND IsActive='Y' AND AD_Client_ID = ?"; try { pstmt = DB.prepareStatement(sql, get_TrxName()); pstmt.setInt(1, getAD_Role_ID()); + pstmt.setInt(2, Env.getAD_Client_ID(getCtx())); rs = pstmt.executeQuery(); while (rs.next()) {