IDEMPIERE-4268 Web Services : Read miss cross-tenant check (#456)
Extracting from @hengsin pull request 453
This commit is contained in:
parent
f2c5ec429b
commit
9d6de521f2
|
@ -36,6 +36,7 @@ public class MUserDefWin extends X_AD_UserDef_Win implements ImmutablePOSupport
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -7542708120229671875L;
|
private static final long serialVersionUID = -7542708120229671875L;
|
||||||
private volatile static List<MUserDefWin> m_fullList = null;
|
private volatile static List<MUserDefWin> m_fullList = null;
|
||||||
|
private static final Object m_fullListLock = new Object();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Standard constructor.
|
* Standard constructor.
|
||||||
|
@ -103,14 +104,16 @@ public class MUserDefWin extends X_AD_UserDef_Win implements ImmutablePOSupport
|
||||||
*/
|
*/
|
||||||
private static MUserDefWin[] getAll (Properties ctx, int window_ID )
|
private static MUserDefWin[] getAll (Properties ctx, int window_ID )
|
||||||
{
|
{
|
||||||
if (m_fullList == null) {
|
synchronized (m_fullListLock) {
|
||||||
try {
|
if (m_fullList == null) {
|
||||||
PO.setCrossTenantSafe();
|
try {
|
||||||
m_fullList = new Query(ctx, MUserDefWin.Table_Name, null, null)
|
PO.setCrossTenantSafe();
|
||||||
.setOnlyActiveRecords(true)
|
m_fullList = new Query(ctx, MUserDefWin.Table_Name, null, null)
|
||||||
.list();
|
.setOnlyActiveRecords(true)
|
||||||
} finally {
|
.list();
|
||||||
PO.clearCrossTenantSafe();
|
} finally {
|
||||||
|
PO.clearCrossTenantSafe();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -209,7 +209,7 @@ public abstract class PO
|
||||||
else
|
else
|
||||||
load(ID, trxName);
|
load(ID, trxName);
|
||||||
|
|
||||||
checkValidClient(false);
|
checkCrossTenant(false);
|
||||||
} // PO
|
} // PO
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2082,7 +2082,7 @@ public abstract class PO
|
||||||
checkImmutable();
|
checkImmutable();
|
||||||
|
|
||||||
checkValidContext();
|
checkValidContext();
|
||||||
checkValidClient(true);
|
checkCrossTenant(true);
|
||||||
CLogger.resetLast();
|
CLogger.resetLast();
|
||||||
boolean newRecord = is_new(); // save locally as load resets
|
boolean newRecord = is_new(); // save locally as load resets
|
||||||
if (!newRecord && !is_Changed())
|
if (!newRecord && !is_Changed())
|
||||||
|
@ -3270,7 +3270,7 @@ public abstract class PO
|
||||||
checkImmutable();
|
checkImmutable();
|
||||||
|
|
||||||
checkValidContext();
|
checkValidContext();
|
||||||
checkValidClient(true);
|
checkCrossTenant(true);
|
||||||
CLogger.resetLast();
|
CLogger.resetLast();
|
||||||
if (is_new())
|
if (is_new())
|
||||||
return true;
|
return true;
|
||||||
|
@ -5002,7 +5002,7 @@ public abstract class PO
|
||||||
isSafeCrossTenant.set(Boolean.FALSE);
|
isSafeCrossTenant.set(Boolean.FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void checkValidClient(boolean writing) {
|
private void checkCrossTenant(boolean writing) {
|
||||||
if (isSafeCrossTenant.get())
|
if (isSafeCrossTenant.get())
|
||||||
return;
|
return;
|
||||||
int envClientID = Env.getAD_Client_ID(getCtx());
|
int envClientID = Env.getAD_Client_ID(getCtx());
|
||||||
|
|
Loading…
Reference in New Issue