From ee3e5644caa0589645a7d229ff3beed2fe9ff7c3 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Wed, 2 Apr 2014 10:53:37 -0500 Subject: [PATCH] IDEMPIERE-1717 Maintenance mode --- .../i2.0/oracle/201404021038_IDEMPIERE-1717.sql | 15 +++++++++++++++ .../postgresql/201404021038_IDEMPIERE-1717.sql | 12 ++++++++++++ .../src/org/compiere/util/Login.java | 9 ++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 migration/i2.0/oracle/201404021038_IDEMPIERE-1717.sql create mode 100644 migration/i2.0/postgresql/201404021038_IDEMPIERE-1717.sql diff --git a/migration/i2.0/oracle/201404021038_IDEMPIERE-1717.sql b/migration/i2.0/oracle/201404021038_IDEMPIERE-1717.sql new file mode 100644 index 0000000000..49aa430d4f --- /dev/null +++ b/migration/i2.0/oracle/201404021038_IDEMPIERE-1717.sql @@ -0,0 +1,15 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- Apr 2, 2014 10:27:03 AM COT +-- IDEMPIERE-1717 Maintenance mode +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,Description,AD_SysConfig_UU,Updated,Created,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200052,'C','N','Define if the system is in manteinance mode. Y = just advanced roles can log in / N = normal operation mode','636b9278-5633-4f92-9180-a2eb4f0674b1',TO_DATE('2014-04-02 10:27:02','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2014-04-02 10:27:02','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'SYSTEM_IN_MAINTENANCE_MODE',0,'D') +; + +-- Apr 2, 2014 10:39:33 AM COT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('E','System is in maintenance mode, please wait until the access is restored.',200268,'D','bc45a082-4784-46a8-b5a5-14874ed5ee69','SystemInMaintenance','Y',TO_DATE('2014-04-02 10:39:32','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2014-04-02 10:39:32','YYYY-MM-DD HH24:MI:SS'),0,0) +; + +SELECT register_migration_script('201404021038_IDEMPIERE-1717.sql') FROM dual +; + diff --git a/migration/i2.0/postgresql/201404021038_IDEMPIERE-1717.sql b/migration/i2.0/postgresql/201404021038_IDEMPIERE-1717.sql new file mode 100644 index 0000000000..6f6f3ad80d --- /dev/null +++ b/migration/i2.0/postgresql/201404021038_IDEMPIERE-1717.sql @@ -0,0 +1,12 @@ +-- Apr 2, 2014 10:27:03 AM COT +-- IDEMPIERE-1717 Maintenance mode +INSERT INTO AD_SysConfig (AD_SysConfig_ID,ConfigurationLevel,Value,Description,AD_SysConfig_UU,Updated,Created,AD_Org_ID,CreatedBy,IsActive,UpdatedBy,Name,AD_Client_ID,EntityType) VALUES (200052,'C','N','Define if the system is in manteinance mode. Y = just advanced roles can log in / N = normal operation mode','636b9278-5633-4f92-9180-a2eb4f0674b1',TO_TIMESTAMP('2014-04-02 10:27:02','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2014-04-02 10:27:02','YYYY-MM-DD HH24:MI:SS'),0,100,'Y',100,'SYSTEM_IN_MAINTENANCE_MODE',0,'D') +; + +-- Apr 2, 2014 10:39:33 AM COT +INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,EntityType,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Client_ID,AD_Org_ID) VALUES ('E','System is in maintenance mode, please wait until the access is restored.',200268,'D','bc45a082-4784-46a8-b5a5-14874ed5ee69','SystemInMaintenance','Y',TO_TIMESTAMP('2014-04-02 10:39:32','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2014-04-02 10:39:32','YYYY-MM-DD HH24:MI:SS'),0,0) +; + +SELECT register_migration_script('201404021038_IDEMPIERE-1717.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/util/Login.java b/org.adempiere.base/src/org/compiere/util/Login.java index 50c3e3df76..cd3d5df0f8 100644 --- a/org.adempiere.base/src/org/compiere/util/Login.java +++ b/org.adempiere.base/src/org/compiere/util/Login.java @@ -768,7 +768,14 @@ public class Login { log.severe("Refused: " + error); return error; - } + } + + // IDEMPIERE-1717 Maintenance mode + if (! MRole.get(m_ctx, AD_Role_ID).isAccessAdvanced()) { + if (MSysConfig.getBooleanValue("SYSTEM_IN_MAINTENANCE_MODE", false, AD_Client_ID)) + return Msg.getMsg(m_ctx, "SystemInMaintenance"); + } + return null; } // validateLogin