diff --git a/migration/i1.0b-release/oracle/201306182217_IDEMPIERE-893.sql b/migration/i1.0b-release/oracle/201306182217_IDEMPIERE-893.sql new file mode 100644 index 0000000000..eec1667efb --- /dev/null +++ b/migration/i1.0b-release/oracle/201306182217_IDEMPIERE-893.sql @@ -0,0 +1,51 @@ +INSERT INTO AD_InfoWindow_Access (AD_InfoWindow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy) +SELECT i.AD_InfoWindow_ID, r.ad_role_id, r.ad_client_id, r.ad_org_id, 'Y', SysDate, 0, SysDate, 0 +FROM AD_InfoWindow i +JOIN AD_Role r ON (r.isactive='Y') +LEFT JOIN AD_InfoWindow_Access ia ON (ia.AD_Role_ID=r.ad_role_id AND i.AD_InfoWindow_ID = ia.AD_InfoWindow_ID) +WHERE ia.AD_InfoWindow_ID IS NULL +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_asset='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='A_Asset')) +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_bpartner='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='C_BPartner')) +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_inout='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='M_InOut')) +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_invoice='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='C_Invoice')) +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_order='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='C_Order')) +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_payment='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='C_Payment')) +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_product='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='M_Product')) +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_resource='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='S_ResourceAssignment')) +; + +SELECT register_migration_script('201306182217_IDEMPIERE-893.sql') FROM dual +; + diff --git a/migration/i1.0b-release/postgresql/201306182217_IDEMPIERE-893.sql b/migration/i1.0b-release/postgresql/201306182217_IDEMPIERE-893.sql new file mode 100644 index 0000000000..24e59a1ebb --- /dev/null +++ b/migration/i1.0b-release/postgresql/201306182217_IDEMPIERE-893.sql @@ -0,0 +1,51 @@ +INSERT INTO AD_InfoWindow_Access (AD_InfoWindow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy) +SELECT i.AD_InfoWindow_ID, r.ad_role_id, r.ad_client_id, r.ad_org_id, 'Y', statement_timestamp(), 0, statement_timestamp(), 0 +FROM AD_InfoWindow i +JOIN AD_Role r ON (r.isactive='Y') +LEFT JOIN AD_InfoWindow_Access ia ON (ia.AD_Role_ID=r.ad_role_id AND i.AD_InfoWindow_ID = ia.AD_InfoWindow_ID) +WHERE ia.AD_InfoWindow_ID IS NULL +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_asset='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='A_Asset')) +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_bpartner='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='C_BPartner')) +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_inout='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='M_InOut')) +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_invoice='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='C_Invoice')) +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_order='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='C_Order')) +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_payment='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='C_Payment')) +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_product='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='M_Product')) +; + +update ad_infowindow_access set isactive='N' +where ad_role_id in (select ad_role_id from ad_role where allow_info_resource='N') +and ad_infowindow_id in (select ad_infowindow_id from ad_infowindow where ad_table_id=(select ad_table_id from ad_table where tablename='S_ResourceAssignment')) +; + +SELECT register_migration_script('201306182217_IDEMPIERE-893.sql') FROM dual +; + diff --git a/migration/processes_post_migration/oracle/04_role_access_update.sql b/migration/processes_post_migration/oracle/04_role_access_update.sql index 92091d0148..db4594cd5b 100644 --- a/migration/processes_post_migration/oracle/04_role_access_update.sql +++ b/migration/processes_post_migration/oracle/04_role_access_update.sql @@ -5,7 +5,7 @@ DECLARE BEGIN FOR r IN (SELECT ad_role_id, userlevel, NAME, ad_client_id, ad_org_id FROM AD_ROLE - WHERE ismanual = 'N' + WHERE ismanual = 'N' AND isactive = 'Y' ORDER BY ad_role_id) LOOP DBMS_OUTPUT.PUT_LINE ('Role : ' || r.NAME || ' - ' || r.ad_role_id); @@ -28,9 +28,9 @@ BEGIN END IF; sqlins := - 'INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite,AD_Window_Access_UU) SELECT DISTINCT w.AD_Window_ID, ' + 'INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT w.AD_Window_ID, ' || r.ad_role_id - || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', Current_Timestamp,0, Current_Timestamp,0,''Y'',generate_uuid() FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) LEFT JOIN AD_Window_Access wa ON (wa.AD_Role_ID=' + || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', SysDate,0, SysDate,0,''Y'' FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) LEFT JOIN AD_Window_Access wa ON (wa.AD_Role_ID=' || r.ad_role_id || ' AND w.AD_Window_ID = wa.AD_Window_ID) WHERE wa.AD_Window_ID IS NULL AND t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt WHERE xt.AD_Window_ID=w.AD_Window_ID) AND tt.AccessLevel IN ' || roleaccesslevelwin; @@ -39,9 +39,9 @@ BEGIN EXECUTE IMMEDIATE sqlins; sqlins := - 'INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite,AD_Process_Access_UU) SELECT DISTINCT p.AD_Process_ID, ' + 'INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT p.AD_Process_ID, ' || r.ad_role_id - || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', Current_Timestamp,0, Current_Timestamp,0,''Y'',generate_uuid() FROM AD_Process p LEFT JOIN AD_Process_Access pa ON (pa.AD_Role_ID=' + || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', SysDate,0, SysDate,0,''Y'' FROM AD_Process p LEFT JOIN AD_Process_Access pa ON (pa.AD_Role_ID=' || r.ad_role_id || ' AND p.AD_Process_ID = pa.AD_Process_ID) WHERE pa.AD_Process_ID IS NULL AND AccessLevel IN ' || roleaccesslevel; @@ -50,9 +50,9 @@ BEGIN EXECUTE IMMEDIATE sqlins; sqlins := - 'INSERT INTO AD_Form_Access (AD_Form_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite,AD_Form_Access_UU) SELECT f.AD_Form_ID, ' + 'INSERT INTO AD_Form_Access (AD_Form_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT f.AD_Form_ID, ' || r.ad_role_id - || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', Current_Timestamp,0, Current_Timestamp,0,''Y'',generate_uuid() FROM AD_Form f LEFT JOIN AD_Form_Access fa ON (fa.AD_Role_ID=' + || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', SysDate,0, SysDate,0,''Y'' FROM AD_Form f LEFT JOIN AD_Form_Access fa ON (fa.AD_Role_ID=' || r.ad_role_id || ' AND f.AD_Form_ID = fa.AD_Form_ID) WHERE fa.AD_Form_ID IS NULL AND AccessLevel IN ' || roleaccesslevel; @@ -61,9 +61,9 @@ BEGIN EXECUTE IMMEDIATE sqlins; sqlins := - 'INSERT INTO AD_WorkFlow_Access (AD_WorkFlow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite,AD_WorkFlow_Access_UU) SELECT w.AD_WorkFlow_ID, ' + 'INSERT INTO AD_WorkFlow_Access (AD_WorkFlow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT w.AD_WorkFlow_ID, ' || r.ad_role_id - || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', Current_Timestamp,0, Current_Timestamp,0,''Y'',generate_uuid() FROM AD_WorkFlow w LEFT JOIN AD_WorkFlow_Access wa ON (wa.AD_Role_ID=' + || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', SysDate,0, SysDate,0,''Y'' FROM AD_WorkFlow w LEFT JOIN AD_WorkFlow_Access wa ON (wa.AD_Role_ID=' || r.ad_role_id || ' AND w.AD_WorkFlow_ID = wa.AD_WorkFlow_ID) WHERE w.AD_Client_ID IN (0,'||r.ad_client_id||') AND wa.AD_WorkFlow_ID IS NULL AND AccessLevel IN ' || roleaccesslevel; @@ -72,9 +72,9 @@ BEGIN EXECUTE IMMEDIATE sqlins; sqlins := - 'INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID, AD_Ref_List_ID, AD_Role_ID,AD_Document_Action_Access_UU) (SELECT ' + 'INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID, AD_Ref_List_ID, AD_Role_ID) (SELECT ' || r.ad_client_id || ',' || r.ad_org_id - || ',''Y'', Current_Timestamp,0, Current_Timestamp,0, doctype.C_DocType_ID, action.AD_Ref_List_ID, rol.AD_Role_ID,generate_uuid() ' + || ',''Y'', SysDate,0, SysDate,0, doctype.C_DocType_ID, action.AD_Ref_List_ID, rol.AD_Role_ID ' || ' FROM AD_Client client INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) INNER JOIN AD_Ref_List action ON (action.AD_Reference_ID=135) INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID AND rol.AD_Role_ID=' || r.ad_role_id || ') LEFT JOIN AD_Document_Action_Access da ON (da.AD_Role_ID=' @@ -83,6 +83,17 @@ BEGIN -- DBMS_OUTPUT.PUT_LINE (sqlins); EXECUTE IMMEDIATE sqlins; + + sqlins := + 'INSERT INTO AD_InfoWindow_Access (AD_InfoWindow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy) SELECT i.AD_InfoWindow_ID, ' + || r.ad_role_id + || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', SysDate,0, SysDate,0 FROM AD_InfoWindow i LEFT JOIN AD_InfoWindow_Access ia ON (ia.AD_Role_ID=' + || r.ad_role_id + || ' AND i.AD_InfoWindow_ID = ia.AD_InfoWindow_ID) WHERE i.AD_Client_ID IN (0,'||r.ad_client_id||') AND ia.AD_InfoWindow_ID IS NULL'; + + -- DBMS_OUTPUT.PUT_LINE (sqlins); + EXECUTE IMMEDIATE sqlins; + END LOOP; COMMIT; diff --git a/migration/processes_post_migration/postgresql/01_add_missing_translations.sql b/migration/processes_post_migration/postgresql/01_add_missing_translations.sql index 4c40cbdeec..5ebac6fe0d 100644 --- a/migration/processes_post_migration/postgresql/01_add_missing_translations.sql +++ b/migration/processes_post_migration/postgresql/01_add_missing_translations.sql @@ -65,5 +65,3 @@ $func$ LANGUAGE plpgsql; select add_missing_translations(); -commit; - diff --git a/migration/processes_post_migration/postgresql/03_update_sequences.sql b/migration/processes_post_migration/postgresql/03_update_sequences.sql index 7239f37c7f..af595be0aa 100644 --- a/migration/processes_post_migration/postgresql/03_update_sequences.sql +++ b/migration/processes_post_migration/postgresql/03_update_sequences.sql @@ -126,4 +126,3 @@ $func$ LANGUAGE plpgsql; select update_sequences(); -commit; diff --git a/migration/processes_post_migration/postgresql/04_role_access_update.sql b/migration/processes_post_migration/postgresql/04_role_access_update.sql index 7018c2f7e4..b3d6987695 100644 --- a/migration/processes_post_migration/postgresql/04_role_access_update.sql +++ b/migration/processes_post_migration/postgresql/04_role_access_update.sql @@ -7,7 +7,7 @@ DECLARE BEGIN FOR r IN (SELECT ad_role_id, userlevel, NAME, ad_client_id, ad_org_id FROM AD_ROLE - WHERE ismanual = 'N' + WHERE ismanual = 'N' AND isactive = 'Y' ORDER BY ad_role_id) LOOP IF r.userlevel = 'S ' -- system @@ -29,9 +29,9 @@ BEGIN END IF; sqlins := - 'INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite,AD_Window_Access_UU) SELECT DISTINCT w.AD_Window_ID, ' + 'INSERT INTO AD_Window_Access (AD_Window_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT w.AD_Window_ID, ' || r.ad_role_id - || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', Current_Timestamp,0, Current_Timestamp,0,''Y'',generate_uuid() FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) LEFT JOIN AD_Window_Access wa ON (wa.AD_Role_ID=' + || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', statement_timestamp(),0, statement_timestamp(),0,''Y'' FROM AD_Window w INNER JOIN AD_Tab t ON (w.AD_Window_ID=t.AD_Window_ID) INNER JOIN AD_Table tt ON (t.AD_Table_ID=tt.AD_Table_ID) LEFT JOIN AD_Window_Access wa ON (wa.AD_Role_ID=' || r.ad_role_id || ' AND w.AD_Window_ID = wa.AD_Window_ID) WHERE wa.AD_Window_ID IS NULL AND t.SeqNo=(SELECT MIN(SeqNo) FROM AD_Tab xt WHERE xt.AD_Window_ID=w.AD_Window_ID) AND tt.AccessLevel IN ' || roleaccesslevelwin; @@ -39,9 +39,9 @@ BEGIN EXECUTE sqlins; sqlins := - 'INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite,AD_Process_Access_UU) SELECT DISTINCT p.AD_Process_ID, ' + 'INSERT INTO AD_Process_Access (AD_Process_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT DISTINCT p.AD_Process_ID, ' || r.ad_role_id - || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', Current_Timestamp,0, Current_Timestamp,0,''Y'',generate_uuid() FROM AD_Process p LEFT JOIN AD_Process_Access pa ON (pa.AD_Role_ID=' + || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', statement_timestamp(),0, statement_timestamp(),0,''Y'' FROM AD_Process p LEFT JOIN AD_Process_Access pa ON (pa.AD_Role_ID=' || r.ad_role_id || ' AND p.AD_Process_ID = pa.AD_Process_ID) WHERE pa.AD_Process_ID IS NULL AND AccessLevel IN ' || roleaccesslevel; @@ -49,9 +49,9 @@ BEGIN EXECUTE sqlins; sqlins := - 'INSERT INTO AD_Form_Access (AD_Form_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite,AD_Form_Access_UU) SELECT f.AD_Form_ID, ' + 'INSERT INTO AD_Form_Access (AD_Form_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT f.AD_Form_ID, ' || r.ad_role_id - || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', Current_Timestamp,0, Current_Timestamp,0,''Y'',generate_uuid() FROM AD_Form f LEFT JOIN AD_Form_Access fa ON (fa.AD_Role_ID=' + || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', statement_timestamp(),0, statement_timestamp(),0,''Y'' FROM AD_Form f LEFT JOIN AD_Form_Access fa ON (fa.AD_Role_ID=' || r.ad_role_id || ' AND f.AD_Form_ID = fa.AD_Form_ID) WHERE fa.AD_Form_ID IS NULL AND AccessLevel IN ' || roleaccesslevel; @@ -59,9 +59,9 @@ BEGIN EXECUTE sqlins; sqlins := - 'INSERT INTO AD_WorkFlow_Access (AD_WorkFlow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite,AD_WorkFlow_Access_UU) SELECT w.AD_WorkFlow_ID, ' + 'INSERT INTO AD_WorkFlow_Access (AD_WorkFlow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadWrite) SELECT w.AD_WorkFlow_ID, ' || r.ad_role_id - || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', Current_Timestamp,0, Current_Timestamp,0,''Y'',generate_uuid() FROM AD_WorkFlow w LEFT JOIN AD_WorkFlow_Access wa ON (wa.AD_Role_ID=' + || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', statement_timestamp(),0, statement_timestamp(),0,''Y'' FROM AD_WorkFlow w LEFT JOIN AD_WorkFlow_Access wa ON (wa.AD_Role_ID=' || r.ad_role_id || ' AND w.AD_WorkFlow_ID = wa.AD_WorkFlow_ID) WHERE w.AD_Client_ID IN (0,'||r.ad_client_id||') AND wa.AD_WorkFlow_ID IS NULL AND AccessLevel IN ' || roleaccesslevel; @@ -69,9 +69,9 @@ BEGIN EXECUTE sqlins; sqlins := - 'INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID, AD_Ref_List_ID, AD_Role_ID,AD_Document_Action_Access_UU) (SELECT ' + 'INSERT INTO AD_Document_Action_Access (AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,C_DocType_ID, AD_Ref_List_ID, AD_Role_ID) (SELECT ' || r.ad_client_id || ',' || r.ad_org_id - || ',''Y'', Current_Timestamp,0, Current_Timestamp,0, doctype.C_DocType_ID, action.AD_Ref_List_ID, rol.AD_Role_ID,generate_uuid() ' + || ',''Y'', statement_timestamp(),0, statement_timestamp(),0, doctype.C_DocType_ID, action.AD_Ref_List_ID, rol.AD_Role_ID ' || ' FROM AD_Client client INNER JOIN C_DocType doctype ON (doctype.AD_Client_ID=client.AD_Client_ID) INNER JOIN AD_Ref_List action ON (action.AD_Reference_ID=135) INNER JOIN AD_Role rol ON (rol.AD_Client_ID=client.AD_Client_ID AND rol.AD_Role_ID=' || r.ad_role_id || ') LEFT JOIN AD_Document_Action_Access da ON (da.AD_Role_ID=' @@ -79,6 +79,16 @@ BEGIN || ' AND da.C_DocType_ID=doctype.C_DocType_ID AND da.AD_Ref_List_ID=action.AD_Ref_List_ID) WHERE (da.C_DocType_ID IS NULL AND da.AD_Ref_List_ID IS NULL))'; EXECUTE sqlins; + + sqlins := + 'INSERT INTO AD_InfoWindow_Access (AD_InfoWindow_ID, AD_Role_ID, AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy) SELECT i.AD_InfoWindow_ID, ' + || r.ad_role_id + || ','||r.ad_client_id||','||r.ad_org_id||',''Y'', statement_timestamp(),0, statement_timestamp(),0 FROM AD_InfoWindow i LEFT JOIN AD_InfoWindow_Access ia ON (ia.AD_Role_ID=' + || r.ad_role_id + || ' AND i.AD_InfoWindow_ID = ia.AD_InfoWindow_ID) WHERE i.AD_Client_ID IN (0,'||r.ad_client_id||') AND ia.AD_InfoWindow_ID IS NULL'; + + EXECUTE sqlins; + END LOOP; END; @@ -86,4 +96,3 @@ $func$ LANGUAGE plpgsql; select role_access_update(); -commit; diff --git a/org.adempiere.base/src/org/compiere/dbPort/Convert.java b/org.adempiere.base/src/org/compiere/dbPort/Convert.java index a34d501ff8..93afb6636c 100644 --- a/org.adempiere.base/src/org/compiere/dbPort/Convert.java +++ b/org.adempiere.base/src/org/compiere/dbPort/Convert.java @@ -486,6 +486,7 @@ public abstract class Convert "AD_CHANGELOG", "AD_DOCUMENT_ACTION_ACCESS", "AD_FORM_ACCESS", + "AD_INFOWINDOW_ACCESS", "AD_ISSUE", "AD_LDAPPROCESSORLOG", "AD_PACKAGE_IMP", diff --git a/org.adempiere.base/src/org/compiere/model/MRole.java b/org.adempiere.base/src/org/compiere/model/MRole.java index 87032e941c..5dcb312474 100644 --- a/org.adempiere.base/src/org/compiere/model/MRole.java +++ b/org.adempiere.base/src/org/compiere/model/MRole.java @@ -485,7 +485,17 @@ public final class MRole extends X_AD_Role + " AND da.C_DocType_ID=doctype.C_DocType_ID AND da.AD_Ref_List_ID=action.AD_Ref_List_ID) " + "WHERE (da.C_DocType_ID IS NULL AND da.AD_Ref_List_ID IS NULL)) "; - + String sqlInfo = "INSERT INTO AD_InfoWindow_Access " + + "(AD_InfoWindow_ID, AD_Role_ID," + + " AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy) " + + "SELECT i.AD_InfoWindow_ID," + getAD_Role_ID() + "," + + getAD_Client_ID() + "," + getAD_Org_ID() + ",'Y',SysDate," + + getUpdatedBy() + ", SysDate," + getUpdatedBy() + + " FROM AD_InfoWindow i LEFT JOIN AD_InfoWindow_Access ia ON " + + "(ia.AD_Role_ID=" + getAD_Role_ID() + + " AND i.AD_InfoWindow_ID = ia.AD_InfoWindow_ID) " + + "WHERE i.AD_Client_ID IN (0," + getAD_Client_ID() + ") AND ia.AD_InfoWindow_ID IS NULL"; + /** * Fill AD_xx_Access * --------------------------------------------------------------------------- @@ -525,13 +535,15 @@ public final class MRole extends X_AD_Role int form = DB.executeUpdateEx(sqlForm + roleAccessLevel, get_TrxName()); int wf = DB.executeUpdateEx(sqlWorkflow + roleAccessLevel, get_TrxName()); int docact = DB.executeUpdateEx(sqlDocAction, get_TrxName()); - + int info = DB.executeUpdateEx(sqlInfo, get_TrxName()); + loadAccess(true); return "@AD_Window_ID@ #" + win + " - @AD_Process_ID@ #" + proc + " - @AD_Form_ID@ #" + form + " - @AD_Workflow_ID@ #" + wf - + " - @DocAction@ #" + docact; + + " - @DocAction@ #" + docact + + " - @AD_InfoWindow_ID@ #" + info; } // createAccessRecords @@ -546,13 +558,14 @@ public final class MRole extends X_AD_Role int formDel = DB.executeUpdateEx("DELETE FROM AD_Form_Access" + whereDel, get_TrxName()); int wfDel = DB.executeUpdateEx("DELETE FROM AD_WorkFlow_Access" + whereDel, get_TrxName()); int docactDel = DB.executeUpdateEx("DELETE FROM AD_Document_Action_Access" + whereDel, get_TrxName()); - + int infoDel = DB.executeUpdateEx("DELETE FROM AD_InfoWindow_Access" + whereDel, get_TrxName()); if (log.isLoggable(Level.FINE)) log.fine("AD_Window_Access=" + winDel + ", AD_Process_Access=" + procDel + ", AD_Form_Access=" + formDel + ", AD_Workflow_Access=" + wfDel - + ", AD_Document_Action_Access=" + docactDel); + + ", AD_Document_Action_Access=" + docactDel + + ", AD_InfoWindow_Access=" + infoDel); } /** @@ -644,6 +657,8 @@ public final class MRole extends X_AD_Role private HashMap m_workflowAccess = null; /** Form Access */ private HashMap m_formAccess = null; + /** Info Windows */ + private HashMap m_infoAccess; /** * Set Logged in user @@ -2784,7 +2799,6 @@ public final class MRole extends X_AD_Role } private int m_includedSeqNo = -1; - private HashMap m_infoAccess; /** * Merge permissions access