From ee3df039bfb12d3b819be2d05c8d04960558bdc0 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud <58596990+nmicoud@users.noreply.github.com> Date: Tue, 22 Feb 2022 07:33:47 +0100 Subject: [PATCH] =?UTF-8?q?IDEMPIERE-5180=20:=20Add=20client=20name=20on?= =?UTF-8?q?=20RoleAccessUpdate=20process=20and=20add=20=E2=80=A6=20(#1159)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * IDEMPIERE-5180 : Add client name on RoleAccessUpdate process and add client validation * IDEMPIERE-5181 : RoleAccessUpdate add role validation * IDEMPIERE-5181 : RoleAccessUpdate fix client validation * IDEMPIERE-5181 : RoleAccessUpdate - remove on Client parameter --- .../i9/oracle/202202041530_IDEMPIERE-5180.sql | 30 +++++++++++++++++++ .../202202041530_IDEMPIERE-5180.sql | 27 +++++++++++++++++ .../compiere/process/RoleAccessUpdate.java | 23 +++++--------- 3 files changed, 64 insertions(+), 16 deletions(-) create mode 100644 migration/i9/oracle/202202041530_IDEMPIERE-5180.sql create mode 100644 migration/i9/postgresql/202202041530_IDEMPIERE-5180.sql diff --git a/migration/i9/oracle/202202041530_IDEMPIERE-5180.sql b/migration/i9/oracle/202202041530_IDEMPIERE-5180.sql new file mode 100644 index 0000000000..5b6e2b6985 --- /dev/null +++ b/migration/i9/oracle/202202041530_IDEMPIERE-5180.sql @@ -0,0 +1,30 @@ +SET SQLBLANKLINES ON +SET DEFINE OFF + +-- IDEMPIERE-5180 +-- Feb 5, 2022, 10:01:05 AM CET +INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Description,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200153,'AD_Role of Client - Not manual only','Not manual roles of current client','S','AD_Role.AD_Client_ID=@#AD_Client_ID@ AND AD_Role.IsManual=''N''',0,0,'Y',TO_DATE('2022-02-05 10:01:05','YYYY-MM-DD HH24:MI:SS'),0,TO_DATE('2022-02-05 10:01:05','YYYY-MM-DD HH24:MI:SS'),0,'D','c79f3aa1-27ec-429f-b8e9-72b7ddc95dc2') +; + +-- Feb 5, 2022, 10:01:16 AM CET +UPDATE AD_Process_Para SET AD_Val_Rule_ID=200153,Updated=TO_DATE('2022-02-05 10:01:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=539 +; + +-- Feb 8, 2022, 8:25:06 AM CET +UPDATE AD_Process SET Help='Update the access rights of a role or all roles of a client to windows, forms, processes and workflows. Note that a role is only updated if it is not marked as manual.',Updated=TO_DATE('2022-02-08 08:25:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=295 +; + +-- Feb 8, 2022, 1:24:16 PM CET +DELETE FROM AD_Process_Para_Trl WHERE AD_Process_Para_ID=538 +; + +-- Feb 8, 2022, 1:24:16 PM CET +DELETE FROM AD_Process_Para WHERE AD_Process_Para_ID=538 +; + +-- Feb 8, 2022, 1:25:37 PM CET +UPDATE AD_Process SET Help='Update the access rights of a role or all roles of a client to windows, forms, processes and workflows. Note that a role is only updated if it is not marked as manual. Note that if is executed from System client and role is not set, all tenant will be udpated',Updated=TO_DATE('2022-02-08 13:25:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=295 +; + +SELECT register_migration_script('202202041530_IDEMPIERE-5180.sql') FROM dual +; diff --git a/migration/i9/postgresql/202202041530_IDEMPIERE-5180.sql b/migration/i9/postgresql/202202041530_IDEMPIERE-5180.sql new file mode 100644 index 0000000000..85f4cf048f --- /dev/null +++ b/migration/i9/postgresql/202202041530_IDEMPIERE-5180.sql @@ -0,0 +1,27 @@ +-- IDEMPIERE-5180 +-- Feb 5, 2022, 10:01:05 AM CET +INSERT INTO AD_Val_Rule (AD_Val_Rule_ID,Name,Description,Type,Code,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Val_Rule_UU) VALUES (200153,'AD_Role of Client - Not manual only','Not manual roles of current client','S','AD_Role.AD_Client_ID=@#AD_Client_ID@ AND AD_Role.IsManual=''N''',0,0,'Y',TO_TIMESTAMP('2022-02-05 10:01:05','YYYY-MM-DD HH24:MI:SS'),0,TO_TIMESTAMP('2022-02-05 10:01:05','YYYY-MM-DD HH24:MI:SS'),0,'D','c79f3aa1-27ec-429f-b8e9-72b7ddc95dc2') +; + +-- Feb 5, 2022, 10:01:16 AM CET +UPDATE AD_Process_Para SET AD_Val_Rule_ID=200153,Updated=TO_TIMESTAMP('2022-02-05 10:01:16','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_Para_ID=539 +; + +-- Feb 8, 2022, 8:25:06 AM CET +UPDATE AD_Process SET Help='Update the access rights of a role or all roles of a client to windows, forms, processes and workflows. Note that a role is only updated if it is not marked as manual.',Updated=TO_TIMESTAMP('2022-02-08 08:25:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=295 +; + +-- Feb 8, 2022, 1:24:16 PM CET +DELETE FROM AD_Process_Para_Trl WHERE AD_Process_Para_ID=538 +; + +-- Feb 8, 2022, 1:24:16 PM CET +DELETE FROM AD_Process_Para WHERE AD_Process_Para_ID=538 +; + +-- Feb 8, 2022, 1:25:37 PM CET +UPDATE AD_Process SET Help='Update the access rights of a role or all roles of a client to windows, forms, processes and workflows. Note that a role is only updated if it is not marked as manual. Note that if is executed from System client and role is not set, all tenant will be udpated',Updated=TO_TIMESTAMP('2022-02-08 13:25:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=0 WHERE AD_Process_ID=295 +; + +SELECT register_migration_script('202202041530_IDEMPIERE-5180.sql') FROM dual +; diff --git a/org.adempiere.base.process/src/org/compiere/process/RoleAccessUpdate.java b/org.adempiere.base.process/src/org/compiere/process/RoleAccessUpdate.java index bc54220540..70146629e8 100644 --- a/org.adempiere.base.process/src/org/compiere/process/RoleAccessUpdate.java +++ b/org.adempiere.base.process/src/org/compiere/process/RoleAccessUpdate.java @@ -21,6 +21,7 @@ import java.util.List; import java.util.logging.Level; import org.compiere.Adempiere; +import org.compiere.model.MClient; import org.compiere.model.MRole; import org.compiere.model.Query; import org.compiere.model.SystemIDs; @@ -38,7 +39,7 @@ import org.compiere.util.Env; *