From fda23ef1ae580a245ffa90c7fe41a8eddbc9d5f1 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 12 May 2022 07:35:20 +0200 Subject: [PATCH] IDEMPIERE-5174 Disable System User (#1324) Found also two minor performance improvements: - avoid counting users when statistics not allowed - change the query where to 1=0, better for the optimizer --- org.adempiere.base/src/org/compiere/model/MSystem.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/org.adempiere.base/src/org/compiere/model/MSystem.java b/org.adempiere.base/src/org/compiere/model/MSystem.java index 4ae8691ceb..9026be2611 100644 --- a/org.adempiere.base/src/org/compiere/model/MSystem.java +++ b/org.adempiere.base/src/org/compiere/model/MSystem.java @@ -352,9 +352,9 @@ public class MSystem extends X_AD_System try { setDBInfo(); - setInternalUsers(); if (isAllowStatistics()) { + setInternalUsers(); setStatisticsInfo(getStatisticsInfo(true)); setProfileInfo(getProfileInfo(true)); } @@ -377,7 +377,7 @@ public class MSystem extends X_AD_System + "FROM AD_User u" + " INNER JOIN AD_User_Roles ur ON (u.AD_User_ID=ur.AD_User_ID) " + "WHERE u.AD_Client_ID<>11" // no Demo - + " AND u.AD_User_ID NOT IN (0,100)"; // no System/SuperUser + + " AND u.AD_User_ID NOT IN (0,10,100)"; // no System/SuperUser int internalUsers = DB.getSQLValue(null, sql); setSupportUnits(internalUsers); } // setInternalUsers @@ -437,7 +437,7 @@ public class MSystem extends X_AD_System + " || '.' || SYS_CONTEXT('USERENV','DB_DOMAIN') AS DBName " + "FROM DUAL"; // - return "SELECT NULL,NULL FROM AD_System WHERE AD_System_ID=-1"; + return "SELECT NULL,NULL FROM DUAL WHERE 1=0"; } // getDBInfoSQL