From dcd5e0421ff036a251323a4665afa547abd25e94 Mon Sep 17 00:00:00 2001 From: Carlos Ruiz Date: Thu, 22 Mar 2018 10:22:06 -0300 Subject: [PATCH] IDEMPIERE-3664 New Role - User Assignment --- .../i5.1/oracle/201803221017_IDEMPIERE-3664.sql | 15 +++++++++++++++ .../postgresql/201803221017_IDEMPIERE-3664.sql | 12 ++++++++++++ .../src/org/compiere/model/MRole.java | 2 +- .../src/org/compiere/model/MSysConfig.java | 3 ++- 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 migration/i5.1/oracle/201803221017_IDEMPIERE-3664.sql create mode 100644 migration/i5.1/postgresql/201803221017_IDEMPIERE-3664.sql diff --git a/migration/i5.1/oracle/201803221017_IDEMPIERE-3664.sql b/migration/i5.1/oracle/201803221017_IDEMPIERE-3664.sql new file mode 100644 index 0000000000..74d8baf049 --- /dev/null +++ b/migration/i5.1/oracle/201803221017_IDEMPIERE-3664.sql @@ -0,0 +1,15 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-3664 +-- Mar 22, 2018 10:16:54 AM BRT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200116,0,0,TO_DATE('2018-03-22 10:16:53','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2018-03-22 10:16:53','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','AUTO_ASSIGN_ROLE_TO_CREATOR_USER','N','Defines if a role is assigned to the creator user when creating a new role ','D','S','dc4be8d1-a164-4e6d-8e02-be6c498d1669') +; + +-- Mar 22, 2018 10:17:03 AM BRT +UPDATE AD_SysConfig SET ConfigurationLevel='C',Updated=TO_DATE('2018-03-22 10:17:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200116 +; + +SELECT register_migration_script('201803221017_IDEMPIERE-3664.sql') FROM dual +; + diff --git a/migration/i5.1/postgresql/201803221017_IDEMPIERE-3664.sql b/migration/i5.1/postgresql/201803221017_IDEMPIERE-3664.sql new file mode 100644 index 0000000000..064cb34c56 --- /dev/null +++ b/migration/i5.1/postgresql/201803221017_IDEMPIERE-3664.sql @@ -0,0 +1,12 @@ +-- IDEMPIERE-3664 +-- Mar 22, 2018 10:16:54 AM BRT +INSERT INTO AD_SysConfig (AD_SysConfig_ID,AD_Client_ID,AD_Org_ID,Created,Updated,CreatedBy,UpdatedBy,IsActive,Name,Value,Description,EntityType,ConfigurationLevel,AD_SysConfig_UU) VALUES (200116,0,0,TO_TIMESTAMP('2018-03-22 10:16:53','YYYY-MM-DD HH24:MI:SS'),TO_TIMESTAMP('2018-03-22 10:16:53','YYYY-MM-DD HH24:MI:SS'),100,100,'Y','AUTO_ASSIGN_ROLE_TO_CREATOR_USER','N','Defines if a role is assigned to the creator user when creating a new role ','D','S','dc4be8d1-a164-4e6d-8e02-be6c498d1669') +; + +-- Mar 22, 2018 10:17:03 AM BRT +UPDATE AD_SysConfig SET ConfigurationLevel='C',Updated=TO_TIMESTAMP('2018-03-22 10:17:03','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_SysConfig_ID=200116 +; + +SELECT register_migration_script('201803221017_IDEMPIERE-3664.sql') FROM dual +; + diff --git a/org.adempiere.base/src/org/compiere/model/MRole.java b/org.adempiere.base/src/org/compiere/model/MRole.java index 2e5fc3d285..7b07d0ba6b 100644 --- a/org.adempiere.base/src/org/compiere/model/MRole.java +++ b/org.adempiere.base/src/org/compiere/model/MRole.java @@ -371,7 +371,7 @@ public final class MRole extends X_AD_Role MUserRoles su = new MUserRoles(getCtx(), SUPERUSER_USER_ID, getAD_Role_ID(), get_TrxName()); su.saveEx(); // Add Role to User - if (getCreatedBy() != SUPERUSER_USER_ID) + if (getCreatedBy() != SUPERUSER_USER_ID && MSysConfig.getBooleanValue(MSysConfig.AUTO_ASSIGN_ROLE_TO_CREATOR_USER, false, getAD_Client_ID())) { MUserRoles ur = new MUserRoles(getCtx(), getCreatedBy(), getAD_Role_ID(), get_TrxName()); ur.saveEx(); diff --git a/org.adempiere.base/src/org/compiere/model/MSysConfig.java b/org.adempiere.base/src/org/compiere/model/MSysConfig.java index e64b48096e..ad9fbaec99 100644 --- a/org.adempiere.base/src/org/compiere/model/MSysConfig.java +++ b/org.adempiere.base/src/org/compiere/model/MSysConfig.java @@ -42,7 +42,7 @@ public class MSysConfig extends X_AD_SysConfig /** * */ - private static final long serialVersionUID = 2617379167881737860L; + private static final long serialVersionUID = -2698648078997788547L; public static final String ADDRESS_VALIDATION = "ADDRESS_VALIDATION"; public static final String ALERT_SEND_ATTACHMENT_AS_XLS = "ALERT_SEND_ATTACHMENT_AS_XLS"; @@ -61,6 +61,7 @@ public class MSysConfig extends X_AD_SysConfig public static final String APPLICATION_OS_INFO_SHOWN = "APPLICATION_OS_INFO_SHOWN"; public static final String APPLICATION_URL = "APPLICATION_URL"; public static final String ATTACH_EMBEDDED_2PACK = "ATTACH_EMBEDDED_2PACK"; + public static final String AUTO_ASSIGN_ROLE_TO_CREATOR_USER = "AUTO_ASSIGN_ROLE_TO_CREATOR_USER"; public static final String AUTOMATIC_PACKIN_FOLDERS = "AUTOMATIC_PACKIN_FOLDERS"; public static final String AUTOMATIC_PACKIN_INITIAL_DELAY = "AUTOMATIC_PACKIN_INITIAL_DELAY"; public static final String AUTOMATIC_PACKIN_PROCESSING = "AUTOMATIC_PACKIN_PROCESSING";