From 138daff406401ffe878563b7a9757e0d2d39cc38 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 26 Feb 2015 20:24:51 -0500 Subject: [PATCH] IDEMPIERE-1800 Reset Locked Account shows all clients / IDEMPIERE-373 --- .../oracle/201502261959_IDEMPIERE-1800.sql | 27 +++++++++++++++++++ .../201502261959_IDEMPIERE-1800.sql | 24 +++++++++++++++++ .../adempiere/process/ResetLockedAccount.java | 6 ++--- 3 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 migration/i2.1/oracle/201502261959_IDEMPIERE-1800.sql create mode 100644 migration/i2.1/postgresql/201502261959_IDEMPIERE-1800.sql diff --git a/migration/i2.1/oracle/201502261959_IDEMPIERE-1800.sql b/migration/i2.1/oracle/201502261959_IDEMPIERE-1800.sql new file mode 100644 index 0000000000..ca3db98708 --- /dev/null +++ b/migration/i2.1/oracle/201502261959_IDEMPIERE-1800.sql @@ -0,0 +1,27 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-1800 Reset Locked Account shows all clients +-- Feb 26, 2015 7:56:16 PM COT +UPDATE AD_Process_Para SET AD_Val_Rule_ID=116, DefaultValue='@#AD_Client_ID@',Updated=TO_DATE('2015-02-26 19:56:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200029 +; + +-- Feb 26, 2015 7:58:22 PM COT +INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200067,'AD_User Locked of Client','S','AD_User.AD_Client_ID=@#AD_Client_ID@ AND IsLocked=''Y''',0,0,'Y',TO_DATE('2015-02-26 19:58:20','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2015-02-26 19:58:20','YYYY-MM-DD HH24:MI:SS'),100,'D','13699034-b9eb-493f-9156-2d6864f366d1') +; + +-- Feb 26, 2015 7:58:33 PM COT +UPDATE AD_Process_Para SET AD_Val_Rule_ID=200067,Updated=TO_DATE('2015-02-26 19:58:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200030 +; + +-- Feb 26, 2015 7:58:42 PM COT +UPDATE AD_Process_Para SET IsActive='N',Updated=TO_DATE('2015-02-26 19:58:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200029 +; + +-- Feb 26, 2015 8:21:57 PM COT +UPDATE AD_Process SET Help='Select a locked user from the list to unlock it. Alternatively you can run the process without selecting any user, in this case the process will unlock all locked users from the client applying accordingly the policies configured for "max account lock" and "max inactive period".',Updated=TO_DATE('2015-02-26 20:21:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=200008 +; + +SELECT register_migration_script('201502261959_IDEMPIERE-1800.sql') FROM dual +; + diff --git a/migration/i2.1/postgresql/201502261959_IDEMPIERE-1800.sql b/migration/i2.1/postgresql/201502261959_IDEMPIERE-1800.sql new file mode 100644 index 0000000000..fa4e7dffd6 --- /dev/null +++ b/migration/i2.1/postgresql/201502261959_IDEMPIERE-1800.sql @@ -0,0 +1,24 @@ +-- IDEMPIERE-1800 Reset Locked Account shows all clients +-- Feb 26, 2015 7:56:16 PM COT +UPDATE AD_Process_Para SET AD_Val_Rule_ID=116, DefaultValue='@#AD_Client_ID@',Updated=TO_TIMESTAMP('2015-02-26 19:56:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200029 +; + +-- Feb 26, 2015 7:58:22 PM COT +INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200067,'AD_User Locked of Client','S','AD_User.AD_Client_ID=@#AD_Client_ID@ AND IsLocked=''Y''',0,0,'Y',TO_TIMESTAMP('2015-02-26 19:58:20','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2015-02-26 19:58:20','YYYY-MM-DD HH24:MI:SS'),100,'D','13699034-b9eb-493f-9156-2d6864f366d1') +; + +-- Feb 26, 2015 7:58:33 PM COT +UPDATE AD_Process_Para SET AD_Val_Rule_ID=200067,Updated=TO_TIMESTAMP('2015-02-26 19:58:33','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200030 +; + +-- Feb 26, 2015 7:58:42 PM COT +UPDATE AD_Process_Para SET IsActive='N',Updated=TO_TIMESTAMP('2015-02-26 19:58:42','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_Para_ID=200029 +; + +-- Feb 26, 2015 8:21:57 PM COT +UPDATE AD_Process SET Help='Select a locked user from the list to unlock it. Alternatively you can run the process without selecting any user, in this case the process will unlock all locked users from the client applying accordingly the policies configured for "max account lock" and "max inactive period".',Updated=TO_TIMESTAMP('2015-02-26 20:21:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=200008 +; + +SELECT register_migration_script('201502261959_IDEMPIERE-1800.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/adempiere/process/ResetLockedAccount.java b/org.adempiere.base/src/org/adempiere/process/ResetLockedAccount.java index fae4fd5313..3564e27ab6 100644 --- a/org.adempiere.base/src/org/adempiere/process/ResetLockedAccount.java +++ b/org.adempiere.base/src/org/adempiere/process/ResetLockedAccount.java @@ -47,7 +47,7 @@ public class ResetLockedAccount extends SvrProcess { if (!user.isLocked()) throw new AdempiereException("User " + user.getName() + " is not locked"); - StringBuilder sql = new StringBuilder ("UPDATE AD_User SET IsLocked = 'N', DateAccountLocked=NULL, FailedLoginCount=0, DateLastLogin=NULL, Updated=SysDate ") + StringBuilder sql = new StringBuilder ("UPDATE AD_User SET IsLocked = 'N', DateAccountLocked=NULL, FailedLoginCount=0, Updated=SysDate ") .append(" WHERE IsLocked='Y' AND AD_Client_ID = ? ") .append(" AND DateAccountLocked IS NOT NULL ") .append(" AND AD_User_ID = " + user.getAD_User_ID()); @@ -63,8 +63,8 @@ public class ResetLockedAccount extends SvrProcess { int MAX_ACCOUNT_LOCK_MINUTES = MSysConfig.getIntValue(MSysConfig.USER_LOCKING_MAX_ACCOUNT_LOCK_MINUTES, 0); int MAX_INACTIVE_PERIOD = MSysConfig.getIntValue(MSysConfig.USER_LOCKING_MAX_INACTIVE_PERIOD_DAY, 0); - StringBuilder sql = new StringBuilder("UPDATE AD_User SET IsLocked = 'N', DateAccountLocked=NULL, FailedLoginCount=0, DateLastLogin=NULL, Updated=SysDate ") - .append(" WHERE IsLocked='Y' AND AD_Client_ID IN (0, ?) ") + StringBuilder sql = new StringBuilder("UPDATE AD_User SET IsLocked = 'N', DateAccountLocked=NULL, FailedLoginCount=0, Updated=SysDate ") + .append(" WHERE IsLocked='Y' AND AD_Client_ID = ? ") .append(" AND DateAccountLocked IS NOT NULL"); if (DB.isPostgreSQL())