diff --git a/migration/i6.2/oracle/201908201457_IDEMPIERE-3936.sql b/migration/i6.2/oracle/201908201457_IDEMPIERE-3936.sql new file mode 100644 index 0000000000..2e36632af8 --- /dev/null +++ b/migration/i6.2/oracle/201908201457_IDEMPIERE-3936.sql @@ -0,0 +1,7 @@ +DELETE FROM AD_InfoWindow_Access WHERE ad_infowindow_id IN (SELECT ad_infowindow_id FROM ad_infowindow iw JOIN ad_table t ON (iw.ad_table_id=t.ad_table_id) WHERE t.AccessLevel='4') AND ad_role_id IN (SELECT ad_role_id FROM ad_role WHERE ismanual='N' AND isactive='Y' AND userlevel!='S '); + +DELETE FROM AD_InfoWindow_Access WHERE ad_infowindow_id IN (SELECT ad_infowindow_id FROM ad_infowindow iw JOIN ad_table t ON (iw.ad_table_id=t.ad_table_id) WHERE t.AccessLevel IN ('1','2','3')) AND ad_role_id IN (SELECT ad_role_id FROM ad_role WHERE ismanual='N' AND isactive='Y' AND userlevel='S '); + +SELECT register_migration_script('201908201457_IDEMPIERE-3936.sql') FROM dual +; + diff --git a/migration/i6.2/postgresql/201908201457_IDEMPIERE-3936.sql b/migration/i6.2/postgresql/201908201457_IDEMPIERE-3936.sql new file mode 100644 index 0000000000..2e36632af8 --- /dev/null +++ b/migration/i6.2/postgresql/201908201457_IDEMPIERE-3936.sql @@ -0,0 +1,7 @@ +DELETE FROM AD_InfoWindow_Access WHERE ad_infowindow_id IN (SELECT ad_infowindow_id FROM ad_infowindow iw JOIN ad_table t ON (iw.ad_table_id=t.ad_table_id) WHERE t.AccessLevel='4') AND ad_role_id IN (SELECT ad_role_id FROM ad_role WHERE ismanual='N' AND isactive='Y' AND userlevel!='S '); + +DELETE FROM AD_InfoWindow_Access WHERE ad_infowindow_id IN (SELECT ad_infowindow_id FROM ad_infowindow iw JOIN ad_table t ON (iw.ad_table_id=t.ad_table_id) WHERE t.AccessLevel IN ('1','2','3')) AND ad_role_id IN (SELECT ad_role_id FROM ad_role WHERE ismanual='N' AND isactive='Y' AND userlevel='S '); + +SELECT register_migration_script('201908201457_IDEMPIERE-3936.sql') FROM dual +; + 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 b3d6987695..fc7739bca3 100644 --- a/migration/processes_post_migration/postgresql/04_role_access_update.sql +++ b/migration/processes_post_migration/postgresql/04_role_access_update.sql @@ -85,7 +85,9 @@ BEGIN || 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'; + || ' AND i.AD_InfoWindow_ID = ia.AD_InfoWindow_ID) INNER JOIN AD_Table tt ON (i.AD_Table_ID=tt.AD_Table_ID) WHERE i.AD_Client_ID IN (0,'||r.ad_client_id||') AND ia.AD_InfoWindow_ID IS NULL AND tt.AccessLevel IN ' + || roleaccesslevel; + EXECUTE sqlins; diff --git a/org.adempiere.base/src/org/compiere/model/MRole.java b/org.adempiere.base/src/org/compiere/model/MRole.java index 577bbbf5ab..867bdc7685 100644 --- a/org.adempiere.base/src/org/compiere/model/MRole.java +++ b/org.adempiere.base/src/org/compiere/model/MRole.java @@ -496,7 +496,9 @@ public final class MRole extends X_AD_Role + " 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"; + + " INNER JOIN AD_Table tt ON (i.AD_Table_ID=tt.AD_Table_ID) " + + "WHERE i.AD_Client_ID IN (0," + getAD_Client_ID() + ") AND ia.AD_InfoWindow_ID IS NULL" + + " AND tt.AccessLevel IN "; /** * Fill AD_xx_Access @@ -537,7 +539,7 @@ 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()); + int info = DB.executeUpdateEx(sqlInfo + roleAccessLevel, get_TrxName()); loadAccess(true); return "@AD_Window_ID@ #" + win