IDEMPIERE-5640 - Fix Cross Tenant Sending BroadCast Message (#1750)

* IDEMPIERE-5640 - Fix Cross Tenant Sending BroadCast Message

* IDEMPIERE-5640 - Add validation in fix Cross Tenant Sending BroadCast Message
This commit is contained in:
Jose Leite 2023-03-24 10:20:21 -03:00 committed by GitHub
parent 2d928ed37e
commit 45a8e18d32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 7 deletions

View File

@ -104,14 +104,21 @@ public class MBroadcastMessage extends X_AD_BroadcastMessage implements Immutabl
MBroadcastMessage retValue = s_cache.get(ctx, key, e -> new MBroadcastMessage(ctx, e));
if (retValue == null)
{
retValue = new MBroadcastMessage (ctx, AD_BroadcastMessage_ID, (String)null);
if (retValue.get_ID() == AD_BroadcastMessage_ID)
{
s_cache.put(key, retValue, e -> new MBroadcastMessage(Env.getCtx(), e));
return retValue;
}
return null;
try {
PO.setCrossTenantSafe();
// Here we can receive messages from another tenant and discard them
retValue = new MBroadcastMessage (ctx, AD_BroadcastMessage_ID, (String)null);
} finally {
PO.clearCrossTenantSafe();
}
if (retValue.get_ID() != AD_BroadcastMessage_ID)
return null;
s_cache.put(key, retValue, e -> new MBroadcastMessage(Env.getCtx(), e));
}
if (retValue != null
&& retValue.getAD_Client_ID() != 0
&& retValue.getAD_Client_ID() != Env.getAD_Client_ID(ctx))
return null;
return retValue;
} // get