IDEMPIERE-3780 AD_User.IsNoExpire to override MAX_INACTIVE_PERIOD_DAY

This commit is contained in:
Nicolas Micoud 2018-12-15 16:50:08 +01:00
parent 867a86250d
commit 69b0ad5ce8
5 changed files with 84 additions and 3 deletions

View File

@ -0,0 +1,26 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-3780 : AD_User.IsNoExpire to override MAX_INACTIVE_PERIOD_DAY
-- Aug 31, 2018 11:49:36 AM CEST
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203266,0,0,'Y',TO_DATE('2018-08-31 11:49:36','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2018-08-31 11:49:36','YYYY-MM-DD HH24:MI:SS'),0,'IsNoExpire','No Expire','No Expire','D','86e9d8d5-35c5-4ba1-85d3-d674d8f48a2f')
;
-- Aug 31, 2018 11:50:17 AM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213690,0,'No Expire',114,'IsNoExpire','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_DATE('2018-08-31 11:50:17','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2018-08-31 11:50:17','YYYY-MM-DD HH24:MI:SS'),0,203266,'Y','N','D','N','N','N','Y','27a982d2-604b-4efe-982c-6e5004e62072','N',0,'N','Y','N')
;
-- Aug 31, 2018 11:50:19 AM CEST
ALTER TABLE AD_User ADD IsNoExpire CHAR(1) DEFAULT 'N' CHECK (IsNoExpire IN ('Y','N')) NOT NULL
;
-- Aug 31, 2018 11:50:38 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (205827,'No Expire',118,213690,'Y',1,440,'N','N','N','N',0,0,'Y',TO_DATE('2018-08-31 11:50:38','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2018-08-31 11:50:38','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','f96b4141-f3b9-45da-917f-23f9ddc80071','Y',3220,2,2)
;
-- Aug 31, 2018 11:51:05 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=420, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-08-31 11:51:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=205827
;
SELECT register_migration_script('201808311200_IDEMPIERE-3780.sql') FROM dual
;

View File

@ -0,0 +1,23 @@
-- IDEMPIERE-3780 : AD_User.IsNoExpire to override MAX_INACTIVE_PERIOD_DAY
-- Aug 31, 2018 11:49:36 AM CEST
INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,PrintName,EntityType,AD_Element_UU) VALUES (203266,0,0,'Y',TO_TIMESTAMP('2018-08-31 11:49:36','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2018-08-31 11:49:36','YYYY-MM-DD HH24:MI:SS'),0,'IsNoExpire','No Expire','No Expire','D','86e9d8d5-35c5-4ba1-85d3-d674d8f48a2f')
;
-- Aug 31, 2018 11:50:17 AM CEST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,DefaultValue,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213690,0,'No Expire',114,'IsNoExpire','N',1,'N','N','Y','N','N',0,'N',20,0,0,'Y',TO_TIMESTAMP('2018-08-31 11:50:17','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2018-08-31 11:50:17','YYYY-MM-DD HH24:MI:SS'),0,203266,'Y','N','D','N','N','N','Y','27a982d2-604b-4efe-982c-6e5004e62072','N',0,'N','Y','N')
;
-- Aug 31, 2018 11:50:19 AM CEST
ALTER TABLE AD_User ADD COLUMN IsNoExpire CHAR(1) DEFAULT 'N' CHECK (IsNoExpire IN ('Y','N')) NOT NULL
;
-- Aug 31, 2018 11:50:38 AM CEST
INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan) VALUES (205827,'No Expire',118,213690,'Y',1,440,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2018-08-31 11:50:38','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2018-08-31 11:50:38','YYYY-MM-DD HH24:MI:SS'),0,'N','Y','D','f96b4141-f3b9-45da-917f-23f9ddc80071','Y',3220,2,2)
;
-- Aug 31, 2018 11:51:05 AM CEST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=420, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-08-31 11:51:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Field_ID=205827
;
SELECT register_migration_script('201808311200_IDEMPIERE-3780.sql') FROM dual
;

View File

@ -485,6 +485,15 @@ public interface I_AD_User
*/ */
public String getIsMenuAutoExpand(); public String getIsMenuAutoExpand();
/** Column name IsNoExpire */
public static final String COLUMNNAME_IsNoExpire = "IsNoExpire";
/** Set No Expire */
public void setIsNoExpire (boolean IsNoExpire);
/** Get No Expire */
public boolean isNoExpire();
/** Column name IsNoPasswordReset */ /** Column name IsNoPasswordReset */
public static final String COLUMNNAME_IsNoPasswordReset = "IsNoPasswordReset"; public static final String COLUMNNAME_IsNoPasswordReset = "IsNoPasswordReset";

View File

@ -31,7 +31,7 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent
/** /**
* *
*/ */
private static final long serialVersionUID = 20181104L; private static final long serialVersionUID = 20180831L;
/** Standard Constructor */ /** Standard Constructor */
public X_AD_User (Properties ctx, int AD_User_ID, String trxName) public X_AD_User (Properties ctx, int AD_User_ID, String trxName)
@ -52,6 +52,8 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent
// N // N
setIsLocked (false); setIsLocked (false);
// 'N' // 'N'
setIsNoExpire (false);
// N
setIsNoPasswordReset (false); setIsNoPasswordReset (false);
// 'N' // 'N'
setIsSalesLead (false); setIsSalesLead (false);
@ -747,6 +749,27 @@ public class X_AD_User extends PO implements I_AD_User, I_Persistent
return (String)get_Value(COLUMNNAME_IsMenuAutoExpand); return (String)get_Value(COLUMNNAME_IsMenuAutoExpand);
} }
/** Set No Expire.
@param IsNoExpire No Expire */
public void setIsNoExpire (boolean IsNoExpire)
{
set_Value (COLUMNNAME_IsNoExpire, Boolean.valueOf(IsNoExpire));
}
/** Get No Expire.
@return No Expire */
public boolean isNoExpire ()
{
Object oo = get_Value(COLUMNNAME_IsNoExpire);
if (oo != null)
{
if (oo instanceof Boolean)
return ((Boolean)oo).booleanValue();
return "Y".equals(oo);
}
return false;
}
/** Set No Password Reset. /** Set No Password Reset.
@param IsNoPasswordReset No Password Reset */ @param IsNoPasswordReset No Password Reset */
public void setIsNoPasswordReset (boolean IsNoPasswordReset) public void setIsNoPasswordReset (boolean IsNoPasswordReset)

View File

@ -1312,7 +1312,7 @@ public class Login
if (minutes > MAX_ACCOUNT_LOCK_MINUTES) if (minutes > MAX_ACCOUNT_LOCK_MINUTES)
{ {
boolean inactive = false; boolean inactive = false;
if (MAX_INACTIVE_PERIOD_DAY > 0 && user.getDateLastLogin() != null) if (MAX_INACTIVE_PERIOD_DAY > 0 && user.getDateLastLogin() != null && !user.isNoExpire())
{ {
long days = (now - user.getDateLastLogin().getTime()) / (1000 * 60 * 60 * 24); long days = (now - user.getDateLastLogin().getTime()) / (1000 * 60 * 60 * 24);
if (days > MAX_INACTIVE_PERIOD_DAY) if (days > MAX_INACTIVE_PERIOD_DAY)
@ -1331,7 +1331,7 @@ public class Login
} }
} }
if (MAX_INACTIVE_PERIOD_DAY > 0 && !user.isLocked() && user.getDateLastLogin() != null) if (MAX_INACTIVE_PERIOD_DAY > 0 && !user.isLocked() && user.getDateLastLogin() != null && !user.isNoExpire())
{ {
long days = (now - user.getDateLastLogin().getTime()) / (1000 * 60 * 60 * 24); long days = (now - user.getDateLastLogin().getTime()) / (1000 * 60 * 60 * 24);
if (days > MAX_INACTIVE_PERIOD_DAY) if (days > MAX_INACTIVE_PERIOD_DAY)