From 0a0ad7027ce98f678725c83695d8455a3473612d Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 21 Mar 2019 16:04:26 -0300 Subject: [PATCH] IDEMPIERE-3926 Restrict roles in login by type --- .../oracle/201903211444_IDEMPIERE-3926.sql | 222 ++++++++++++++++++ .../201903211444_IDEMPIERE-3926.sql | 219 +++++++++++++++++ .../src/org/compiere/model/I_AD_Role.java | 9 + .../src/org/compiere/model/MRole.java | 49 +++- .../src/org/compiere/model/X_AD_Role.java | 39 ++- .../src/org/compiere/util/Login.java | 26 +- .../src/org/compiere/apps/ALogin.java | 7 +- .../org/adempiere/webui/panel/LoginPanel.java | 6 +- .../org/adempiere/webui/panel/RolePanel.java | 2 +- .../webservices/AbstractService.java | 5 +- 10 files changed, 571 insertions(+), 13 deletions(-) create mode 100644 migration/i6.2/oracle/201903211444_IDEMPIERE-3926.sql create mode 100644 migration/i6.2/postgresql/201903211444_IDEMPIERE-3926.sql diff --git a/migration/i6.2/oracle/201903211444_IDEMPIERE-3926.sql b/migration/i6.2/oracle/201903211444_IDEMPIERE-3926.sql new file mode 100644 index 0000000000..45bb4c1061 --- /dev/null +++ b/migration/i6.2/oracle/201903211444_IDEMPIERE-3926.sql @@ -0,0 +1,222 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3926 Restrict roles in login by type +-- Mar 21, 2019, 2:17:02 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203303,0,0,'Y',TO_DATE('2019-03-21 14:16:45','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:16:45','YYYY-MM-DD HH24:MI:SS'),100,'RoleType','Role Type',NULL,NULL,'Role Type','D','d5790909-7831-4e65-ae23-2621d6916933') +; + +-- Mar 21, 2019, 2:17:50 PM BRT +INSERT INTO AD_Reference (AD_Reference_ID,Name,ValidationType,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,IsOrderByValue,AD_Reference_UU) VALUES (200166,'AD_Role RoleType','L',0,0,'Y',TO_DATE('2019-03-21 14:17:49','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:17:49','YYYY-MM-DD HH24:MI:SS'),100,'D','N','88b0c074-0f6f-4a8b-b76e-e230e340f670') +; + +-- Mar 21, 2019, 2:18:17 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_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,IsHtml) VALUES (213856,0,'Role Type',156,'RoleType',2,'N','N','N','N','N',0,'N',17,200166,0,0,'Y',TO_DATE('2019-03-21 14:18:16','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:18:16','YYYY-MM-DD HH24:MI:SS'),100,203303,'Y','N','D','N','N','N','Y','ab062f58-46e1-4a1a-9245-bfa6dd7f42bb','Y',0,'N','N','N') +; + +-- Mar 21, 2019, 2:18:20 PM BRT +ALTER TABLE AD_Role ADD RoleType VARCHAR2(2) DEFAULT NULL +; + +-- Mar 21, 2019, 2:21:49 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,AD_FieldGroup_ID,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205947,'Role Type',119,213856,'Y',0,450,0,'N','N','N','N',0,0,'Y',TO_DATE('2019-03-21 14:21:48','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:21:48','YYYY-MM-DD HH24:MI:SS'),100,'N','Y',135,'D','69560ba0-28c5-481b-b06f-ba1fb8cf468f','Y',440,1,1,1,'N','N','N') +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=50, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=364 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=60, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=7833 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=363 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200071 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11002 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=930 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=931 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59591 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59592 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10126 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205947 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11003 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5227 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202366 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10813 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=210, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11257 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=220, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8312 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=230, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8310 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=240, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8313 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=250, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8314 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=260, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8311 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=270, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11006 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=280, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12367 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12368 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11256 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50168 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50178 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50176 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50170 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50174 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=360, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50173 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=370, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50172 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=380, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50175 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=390, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50169 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=400, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50177 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204590 +; + +-- Mar 21, 2019, 2:35:20 PM BRT +UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2019-03-21 14:35:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205947 +; + +-- Mar 21, 2019, 2:37:34 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200457,'WebUI',200166,'ZK',0,0,'Y',TO_DATE('2019-03-21 14:37:33','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:37:33','YYYY-MM-DD HH24:MI:SS'),100,'D','af5be523-6318-4b6c-bc8b-f51ecd0de2d0') +; + +-- Mar 21, 2019, 2:37:43 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200458,'WebService',200166,'WS',0,0,'Y',TO_DATE('2019-03-21 14:37:43','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:37:43','YYYY-MM-DD HH24:MI:SS'),100,'D','ff7ae569-ea86-4c21-9aff-6a9073f4b677') +; + +-- Mar 21, 2019, 2:37:53 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200459,'System Support',200166,'SS',0,0,'Y',TO_DATE('2019-03-21 14:37:53','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:37:53','YYYY-MM-DD HH24:MI:SS'),100,'D','3b6ad66c-e962-46a5-a3ec-b8787ee4c754') +; + +-- Mar 21, 2019, 2:38:04 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200460,'Mobile',200166,'MO',0,0,'Y',TO_DATE('2019-03-21 14:38:03','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:38:03','YYYY-MM-DD HH24:MI:SS'),100,'D','78962d5b-b6bb-4798-8f9d-fd36381b58ed') +; + +-- Mar 21, 2019, 2:38:13 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200461,'Swing',200166,'SW',0,0,'Y',TO_DATE('2019-03-21 14:38:12','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:38:12','YYYY-MM-DD HH24:MI:SS'),100,'D','b6d02ebf-6845-47d9-b91e-b956084333e8') +; + +-- Mar 21, 2019, 2:38:27 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200462,'External App 1',200166,'E1',0,0,'Y',TO_DATE('2019-03-21 14:38:27','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:38:27','YYYY-MM-DD HH24:MI:SS'),100,'D','d6bc8c6d-d5bf-458c-81f7-4d3f11303d6d') +; + +-- Mar 21, 2019, 2:38:41 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200463,'External App 2',200166,'E2',0,0,'Y',TO_DATE('2019-03-21 14:38:40','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:38:40','YYYY-MM-DD HH24:MI:SS'),100,'D','79a2e44a-dfd6-4114-b835-5392c4736eb9') +; + +-- Mar 21, 2019, 2:38:46 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200464,'External App 3',200166,'E3',0,0,'Y',TO_DATE('2019-03-21 14:38:46','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:38:46','YYYY-MM-DD HH24:MI:SS'),100,'D','f158da0d-6ad6-4f2e-aa65-099417d6217b') +; + +-- Mar 21, 2019, 2:38:54 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200465,'External App 4',200166,'E4',0,0,'Y',TO_DATE('2019-03-21 14:38:53','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:38:53','YYYY-MM-DD HH24:MI:SS'),100,'D','d136b0f9-658a-4e79-b22f-3cf995da34ff') +; + +-- Mar 21, 2019, 2:39:00 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200466,'External App 5',200166,'E5',0,0,'Y',TO_DATE('2019-03-21 14:38:59','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2019-03-21 14:38:59','YYYY-MM-DD HH24:MI:SS'),100,'D','b06729fb-ce8e-4bff-b6da-0f38bdefa55e') +; + +-- Mar 21, 2019, 2:43:43 PM BRT +UPDATE AD_Role SET RoleType='WS',Updated=TO_DATE('2019-03-21 14:43:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Role_ID=50004 +; + +UPDATE AD_Role SET RoleType='SS',Updated=TO_DATE('2019-03-21 14:43:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Role_ID=0 +; + +SELECT register_migration_script('201903211444_IDEMPIERE-3926.sql') FROM dual +; + diff --git a/migration/i6.2/postgresql/201903211444_IDEMPIERE-3926.sql b/migration/i6.2/postgresql/201903211444_IDEMPIERE-3926.sql new file mode 100644 index 0000000000..6f5002734f --- /dev/null +++ b/migration/i6.2/postgresql/201903211444_IDEMPIERE-3926.sql @@ -0,0 +1,219 @@ +-- IDEMPIERE-3926 Restrict roles in login by type +-- Mar 21, 2019, 2:17:02 PM BRT +INSERT INTO AD_Element (AD_Element_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,ColumnName,Name,Description,Help,PrintName,EntityType,AD_Element_UU) VALUES (203303,0,0,'Y',TO_TIMESTAMP('2019-03-21 14:16:45','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:16:45','YYYY-MM-DD HH24:MI:SS'),100,'RoleType','Role Type',NULL,NULL,'Role Type','D','d5790909-7831-4e65-ae23-2621d6916933') +; + +-- Mar 21, 2019, 2:17:50 PM BRT +INSERT INTO AD_Reference (AD_Reference_ID,Name,ValidationType,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,IsOrderByValue,AD_Reference_UU) VALUES (200166,'AD_Role RoleType','L',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:17:49','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:17:49','YYYY-MM-DD HH24:MI:SS'),100,'D','N','88b0c074-0f6f-4a8b-b76e-e230e340f670') +; + +-- Mar 21, 2019, 2:18:17 PM BRT +INSERT INTO AD_Column (AD_Column_ID,Version,Name,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Reference_Value_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,IsHtml) VALUES (213856,0,'Role Type',156,'RoleType',2,'N','N','N','N','N',0,'N',17,200166,0,0,'Y',TO_TIMESTAMP('2019-03-21 14:18:16','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:18:16','YYYY-MM-DD HH24:MI:SS'),100,203303,'Y','N','D','N','N','N','Y','ab062f58-46e1-4a1a-9245-bfa6dd7f42bb','Y',0,'N','N','N') +; + +-- Mar 21, 2019, 2:18:20 PM BRT +ALTER TABLE AD_Role ADD COLUMN RoleType VARCHAR(2) DEFAULT NULL +; + +-- Mar 21, 2019, 2:21:49 PM BRT +INSERT INTO AD_Field (AD_Field_ID,Name,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,SortNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,AD_FieldGroup_ID,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,XPosition,ColumnSpan,NumLines,IsQuickEntry,IsDefaultFocus,IsAdvancedField) VALUES (205947,'Role Type',119,213856,'Y',0,450,0,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:21:48','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:21:48','YYYY-MM-DD HH24:MI:SS'),100,'N','Y',135,'D','69560ba0-28c5-481b-b06f-ba1fb8cf468f','Y',440,1,1,1,'N','N','N') +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=50, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=364 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=60, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=7833 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=70, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=363 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=90, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200071 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=100, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11002 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=110, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=930 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=120, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=931 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=130, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59591 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=140, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=59592 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=150, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10126 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=160, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205947 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=170, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11003 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=180, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=5227 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=190, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=202366 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=200, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=10813 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=210, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11257 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=220, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8312 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=230, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8310 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET SeqNo=240, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8313 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=250, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8314 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=260, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=8311 +; + +-- Mar 21, 2019, 2:34:40 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=270, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:40','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11006 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=280, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12367 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=12368 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=5, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=11256 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50168 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50178 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50176 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=340, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50170 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=350, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50174 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=360, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50173 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=370, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=6, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50172 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=380, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=2, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50175 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=390, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=3, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50169 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET IsDisplayed='Y', SeqNo=400, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=4, ColumnSpan=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50177 +; + +-- Mar 21, 2019, 2:34:41 PM BRT +UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:34:41','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204590 +; + +-- Mar 21, 2019, 2:35:20 PM BRT +UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2019-03-21 14:35:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205947 +; + +-- Mar 21, 2019, 2:37:34 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200457,'WebUI',200166,'ZK',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:37:33','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:37:33','YYYY-MM-DD HH24:MI:SS'),100,'D','af5be523-6318-4b6c-bc8b-f51ecd0de2d0') +; + +-- Mar 21, 2019, 2:37:43 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200458,'WebService',200166,'WS',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:37:43','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:37:43','YYYY-MM-DD HH24:MI:SS'),100,'D','ff7ae569-ea86-4c21-9aff-6a9073f4b677') +; + +-- Mar 21, 2019, 2:37:53 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200459,'System Support',200166,'SS',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:37:53','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:37:53','YYYY-MM-DD HH24:MI:SS'),100,'D','3b6ad66c-e962-46a5-a3ec-b8787ee4c754') +; + +-- Mar 21, 2019, 2:38:04 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200460,'Mobile',200166,'MO',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:38:03','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:38:03','YYYY-MM-DD HH24:MI:SS'),100,'D','78962d5b-b6bb-4798-8f9d-fd36381b58ed') +; + +-- Mar 21, 2019, 2:38:13 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200461,'Swing',200166,'SW',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:38:12','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:38:12','YYYY-MM-DD HH24:MI:SS'),100,'D','b6d02ebf-6845-47d9-b91e-b956084333e8') +; + +-- Mar 21, 2019, 2:38:27 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200462,'External App 1',200166,'E1',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:38:27','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:38:27','YYYY-MM-DD HH24:MI:SS'),100,'D','d6bc8c6d-d5bf-458c-81f7-4d3f11303d6d') +; + +-- Mar 21, 2019, 2:38:41 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200463,'External App 2',200166,'E2',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:38:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:38:40','YYYY-MM-DD HH24:MI:SS'),100,'D','79a2e44a-dfd6-4114-b835-5392c4736eb9') +; + +-- Mar 21, 2019, 2:38:46 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200464,'External App 3',200166,'E3',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:38:46','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:38:46','YYYY-MM-DD HH24:MI:SS'),100,'D','f158da0d-6ad6-4f2e-aa65-099417d6217b') +; + +-- Mar 21, 2019, 2:38:54 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200465,'External App 4',200166,'E4',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:38:53','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:38:53','YYYY-MM-DD HH24:MI:SS'),100,'D','d136b0f9-658a-4e79-b22f-3cf995da34ff') +; + +-- Mar 21, 2019, 2:39:00 PM BRT +INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200466,'External App 5',200166,'E5',0,0,'Y',TO_TIMESTAMP('2019-03-21 14:38:59','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2019-03-21 14:38:59','YYYY-MM-DD HH24:MI:SS'),100,'D','b06729fb-ce8e-4bff-b6da-0f38bdefa55e') +; + +-- Mar 21, 2019, 2:43:43 PM BRT +UPDATE AD_Role SET RoleType='WS',Updated=TO_TIMESTAMP('2019-03-21 14:43:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Role_ID=50004 +; + +UPDATE AD_Role SET RoleType='SS',Updated=TO_TIMESTAMP('2019-03-21 14:43:43','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Role_ID=0 +; + +SELECT register_migration_script('201903211444_IDEMPIERE-3926.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/I_AD_Role.java b/org.adempiere.base/src/org/compiere/model/I_AD_Role.java index fa50ff26ea..fa57444f8d 100644 --- a/org.adempiere.base/src/org/compiere/model/I_AD_Role.java +++ b/org.adempiere.base/src/org/compiere/model/I_AD_Role.java @@ -548,6 +548,15 @@ public interface I_AD_Role */ public String getPreferenceType(); + /** Column name RoleType */ + public static final String COLUMNNAME_RoleType = "RoleType"; + + /** Set Role Type */ + public void setRoleType (String RoleType); + + /** Get Role Type */ + public String getRoleType(); + /** Column name Supervisor_ID */ public static final String COLUMNNAME_Supervisor_ID = "Supervisor_ID"; diff --git a/org.adempiere.base/src/org/compiere/model/MRole.java b/org.adempiere.base/src/org/compiere/model/MRole.java index fedfe537fa..94c8c41ca1 100644 --- a/org.adempiere.base/src/org/compiere/model/MRole.java +++ b/org.adempiere.base/src/org/compiere/model/MRole.java @@ -44,6 +44,7 @@ import org.compiere.util.Ini; import org.compiere.util.KeyNamePair; import org.compiere.util.Msg; import org.compiere.util.Trace; +import org.compiere.util.Util; /** * Role Model. @@ -61,7 +62,7 @@ public final class MRole extends X_AD_Role /** * */ - private static final long serialVersionUID = 8952907008982481439L; + private static final long serialVersionUID = -4649095180532036099L; /** * Get Default (Client) Role @@ -3198,4 +3199,50 @@ public final class MRole extends X_AD_Role return m_canAccess_Info_Product.booleanValue(); } + /** + * Get where clause for a role types list + * @param roleType - comma separated list of role types, NULL can be used + * @param tableName - if table needs to be qualified + * @return whereClause - return null if roleType is null or empty + */ + public static String getWhereRoleType(String roleType, String tableName) { + if (Util.isEmpty(roleType, true)) { + return null; + } + boolean includeNull = false; + String types[] = roleType.split(","); + StringBuilder whereClause = new StringBuilder("("); + boolean start = true; + for (String type : types) { + if ("null".equalsIgnoreCase(type)) { + includeNull = true; + } else { + if (start) { + if (! Util.isEmpty(tableName)) { + whereClause.append(tableName).append("."); + } + whereClause.append(COLUMNNAME_RoleType).append(" IN ("); + start = false; + } else { + whereClause.append(","); + } + whereClause.append(DB.TO_STRING(type)); + } + } + if (! start) { + whereClause.append(")"); + } + if (includeNull) { + if (! start) { + whereClause.append(" OR "); + } + if (! Util.isEmpty(tableName)) { + whereClause.append(tableName).append("."); + } + whereClause.append(COLUMNNAME_RoleType).append(" IS NULL"); + } + whereClause.append(")"); + return whereClause.toString(); + } + } // MRole diff --git a/org.adempiere.base/src/org/compiere/model/X_AD_Role.java b/org.adempiere.base/src/org/compiere/model/X_AD_Role.java index 3ca5a5cd36..bef5882e54 100644 --- a/org.adempiere.base/src/org/compiere/model/X_AD_Role.java +++ b/org.adempiere.base/src/org/compiere/model/X_AD_Role.java @@ -32,7 +32,7 @@ public class X_AD_Role extends PO implements I_AD_Role, I_Persistent /** * */ - private static final long serialVersionUID = 20190106L; + private static final long serialVersionUID = 20190321L; /** Standard Constructor */ public X_AD_Role (Properties ctx, int AD_Role_ID, String trxName) @@ -1003,6 +1003,43 @@ public class X_AD_Role extends PO implements I_AD_Role, I_Persistent return (String)get_Value(COLUMNNAME_PreferenceType); } + /** RoleType AD_Reference_ID=200166 */ + public static final int ROLETYPE_AD_Reference_ID=200166; + /** WebUI = ZK */ + public static final String ROLETYPE_WebUI = "ZK"; + /** WebService = WS */ + public static final String ROLETYPE_WebService = "WS"; + /** System Support = SS */ + public static final String ROLETYPE_SystemSupport = "SS"; + /** Mobile = MO */ + public static final String ROLETYPE_Mobile = "MO"; + /** Swing = SW */ + public static final String ROLETYPE_Swing = "SW"; + /** External App 1 = E1 */ + public static final String ROLETYPE_ExternalApp1 = "E1"; + /** External App 2 = E2 */ + public static final String ROLETYPE_ExternalApp2 = "E2"; + /** External App 3 = E3 */ + public static final String ROLETYPE_ExternalApp3 = "E3"; + /** External App 4 = E4 */ + public static final String ROLETYPE_ExternalApp4 = "E4"; + /** External App 5 = E5 */ + public static final String ROLETYPE_ExternalApp5 = "E5"; + /** Set Role Type. + @param RoleType Role Type */ + public void setRoleType (String RoleType) + { + + set_Value (COLUMNNAME_RoleType, RoleType); + } + + /** Get Role Type. + @return Role Type */ + public String getRoleType () + { + return (String)get_Value(COLUMNNAME_RoleType); + } + public org.compiere.model.I_AD_User getSupervisor() throws RuntimeException { return (org.compiere.model.I_AD_User)MTable.get(getCtx(), org.compiere.model.I_AD_User.Table_Name) diff --git a/org.adempiere.base/src/org/compiere/util/Login.java b/org.adempiere.base/src/org/compiere/util/Login.java index a770447150..820bc4dcba 100644 --- a/org.adempiere.base/src/org/compiere/util/Login.java +++ b/org.adempiere.base/src/org/compiere/util/Login.java @@ -1239,14 +1239,19 @@ public class Login return null; } // getPrincipal + public KeyNamePair[] getClients(String app_user, String app_pwd) { + return getClients(app_user, app_pwd, null); + } + /** * Validate Client Login. * Sets Context with login info * @param app_user user id * @param app_pwd password + * @param roleTypes comma separated list of the role types allowed to login (NULL can be added) * @return client array or null if in error. */ - public KeyNamePair[] getClients(String app_user, String app_pwd) { + public KeyNamePair[] getClients(String app_user, String app_pwd, String roleTypes) { if (log.isLoggable(Level.INFO)) log.info("User=" + app_user); if (Util.isEmpty(app_user)) @@ -1287,10 +1292,15 @@ public class Login where.append("EMail=?"); else where.append("COALESCE(LDAPUser,Name)=?"); + String whereRoleType = MRole.getWhereRoleType(roleTypes, "r"); where.append(" AND") .append(" EXISTS (SELECT * FROM AD_User_Roles ur") .append(" INNER JOIN AD_Role r ON (ur.AD_Role_ID=r.AD_Role_ID)") - .append(" WHERE ur.AD_User_ID=AD_User.AD_User_ID AND ur.IsActive='Y' AND r.IsActive='Y') AND ") + .append(" WHERE ur.AD_User_ID=AD_User.AD_User_ID AND ur.IsActive='Y' AND r.IsActive='Y'"); + if (! Util.isEmpty(whereRoleType)) { + where.append(" AND ").append(whereRoleType); + } + where.append(") AND ") .append(" EXISTS (SELECT * FROM AD_Client c") .append(" WHERE c.AD_Client_ID=AD_User.AD_Client_ID") .append(" AND c.IsActive='Y') AND ") @@ -1511,17 +1521,24 @@ public class Login } return retValue; } + + public KeyNamePair[] getRoles(String app_user, KeyNamePair client) { + return getRoles(app_user, client, null); + } + /************************************************************************** * Load Roles. *

* Sets Client info in context and loads its roles * @param client client information + * @param roleTypes comma separated list of the role types allowed to login (NULL can be added) * @return list of valid roles KeyNodePairs or null if in error */ - public KeyNamePair[] getRoles(String app_user, KeyNamePair client) { + public KeyNamePair[] getRoles(String app_user, KeyNamePair client, String roleTypes) { if (client == null) throw new IllegalArgumentException("Client missing"); + String whereRoleType = MRole.getWhereRoleType(roleTypes, "r"); ArrayList rolesList = new ArrayList(); KeyNamePair[] retValue = null; StringBuffer sql = new StringBuffer("SELECT u.AD_User_ID, r.AD_Role_ID,r.Name ") @@ -1535,6 +1552,9 @@ public class Login else sql.append("COALESCE(u.LDAPUser,u.Name)=?"); sql.append(" AND r.IsMasterRole='N'"); + if (! Util.isEmpty(whereRoleType)) { + sql.append(" AND ").append(whereRoleType); + } sql.append(" AND u.IsActive='Y' AND EXISTS (SELECT * FROM AD_Client c WHERE u.AD_Client_ID=c.AD_Client_ID AND c.IsActive='Y')"); // don't show roles without org access sql.append(" AND ("); diff --git a/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java b/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java index f41fbc0db8..d0a88fddd5 100644 --- a/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java +++ b/org.adempiere.ui.swing/src/org/compiere/apps/ALogin.java @@ -80,7 +80,7 @@ public final class ALogin extends CDialog /** * */ - private static final long serialVersionUID = -3057525535969948097L; + private static final long serialVersionUID = -4397663968578607998L; /** * Construct the dialog. @@ -109,6 +109,7 @@ public final class ALogin extends CDialog } // ALogin + public static final String ROLE_TYPES_SWING = "NULL,SW,SS"; //swing,support+null protected static final String RESOURCE = "org.compiere.apps.ALoginRes"; private static ResourceBundle res = ResourceBundle.getBundle(RESOURCE); /** Logger */ @@ -871,7 +872,7 @@ public final class ALogin extends CDialog KeyNamePair[] clients = null; try { - clients = m_login.getClients(m_user, new String(m_pwd)); + clients = m_login.getClients(m_user, new String(m_pwd), ROLE_TYPES_SWING); if (clients == null || clients.length == 0) { String loginErrMsg = m_login.getLoginErrMsg(); @@ -976,7 +977,7 @@ public final class ALogin extends CDialog Env.setContext(m_ctx, "#SalesRep_ID", user.getAD_User_ID()); } // - KeyNamePair[] roles = m_login.getRoles(userTextField.getText(), client); + KeyNamePair[] roles = m_login.getRoles(userTextField.getText(), client, ROLE_TYPES_SWING); // Make role Combo visible roleCombo.setVisible(true); roleLabel.setVisible(true); diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java index 76dd2494a6..1e6fe43d54 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/LoginPanel.java @@ -101,7 +101,9 @@ public class LoginPanel extends Window implements EventListener /** * */ - private static final long serialVersionUID = -3361823499124119753L; + private static final long serialVersionUID = -6130436148212949636L; + + public static final String ROLE_TYPES_WEBUI = "NULL,ZK,SS"; //webui,support+null private static LogAuthFailure logAuthFailure = new LogAuthFailure(); @@ -575,7 +577,7 @@ public class LoginPanel extends Window implements EventListener Session currSess = Executions.getCurrent().getDesktop().getSession(); - KeyNamePair clientsKNPairs[] = login.getClients(userId, userPassword); + KeyNamePair clientsKNPairs[] = login.getClients(userId, userPassword, ROLE_TYPES_WEBUI); if (clientsKNPairs == null || clientsKNPairs.length == 0) { diff --git a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java index f84899ecad..8125b5e67e 100644 --- a/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java +++ b/org.adempiere.ui.zk/WEB-INF/src/org/adempiere/webui/panel/RolePanel.java @@ -423,7 +423,7 @@ public class RolePanel extends Window implements EventListener, Deferrabl initDefault=m_userpreference.getProperty( UserPreference.P_ROLE ); } KeyNamePair clientKNPair = new KeyNamePair(Integer.valueOf((String)lstItemClient.getValue()), lstItemClient.getLabel()); - KeyNamePair roleKNPairs[] = login.getRoles(m_userName, clientKNPair); + KeyNamePair roleKNPairs[] = login.getRoles(m_userName, clientKNPair, LoginPanel.ROLE_TYPES_WEBUI); if (roleKNPairs != null && roleKNPairs.length > 0) { for (int i = 0; i < roleKNPairs.length; i++) diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java index 35bdf5cea2..14ce7e1ab7 100644 --- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java @@ -66,6 +66,7 @@ import org.idempiere.webservices.fault.IdempiereServiceFault; */ public class AbstractService { + public static final String ROLE_TYPES_WEBSERVICE = "NULL,WS"; //webservice+null private static final String ROLE_ACCESS_SQL = "SELECT IsActive FROM WS_WebServiceTypeAccess WHERE AD_Role_ID IN (" + "SELECT AD_Role_ID FROM AD_Role WHERE AD_Role_ID=? UNION " + "SELECT Included_Role_ID as AD_Role_ID FROM AD_Role_Included WHERE AD_Role_ID=?) " @@ -110,7 +111,7 @@ public class AbstractService { return ret; Login login = new Login(m_cs.getCtx()); - KeyNamePair[] clients = login.getClients(loginRequest.getUser(), loginRequest.getPass()); + KeyNamePair[] clients = login.getClients(loginRequest.getUser(), loginRequest.getPass(), ROLE_TYPES_WEBSERVICE); if (clients == null) return "Error login - User invalid"; m_cs.setPassword(loginRequest.getPass()); @@ -140,7 +141,7 @@ public class AbstractService { Env.setContext(m_cs.getCtx(), "#UserAgent", userAgent == null ? "Unknown" : userAgent); } - KeyNamePair[] roles = login.getRoles(loginRequest.getUser(), selectedClient); + KeyNamePair[] roles = login.getRoles(loginRequest.getUser(), selectedClient, ROLE_TYPES_WEBSERVICE); if (roles != null) { boolean okrole = false; for (KeyNamePair role : roles) {