IDEMPIERE-893 Use AD_InfoWindow_Access instead of DPViews for access to info windows / role access update

This commit is contained in:
Carlos Ruiz 2013-06-18 22:22:00 -05:00
parent b5ad2e2e39
commit 4d31606343
8 changed files with 166 additions and 32 deletions

View File

@ -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
;

View File

@ -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
;

View File

@ -5,7 +5,7 @@ DECLARE
BEGIN BEGIN
FOR r IN (SELECT ad_role_id, userlevel, NAME, ad_client_id, ad_org_id FOR r IN (SELECT ad_role_id, userlevel, NAME, ad_client_id, ad_org_id
FROM AD_ROLE FROM AD_ROLE
WHERE ismanual = 'N' WHERE ismanual = 'N' AND isactive = 'Y'
ORDER BY ad_role_id) ORDER BY ad_role_id)
LOOP LOOP
DBMS_OUTPUT.PUT_LINE ('Role : ' || r.NAME || ' - ' || r.ad_role_id); DBMS_OUTPUT.PUT_LINE ('Role : ' || r.NAME || ' - ' || r.ad_role_id);
@ -28,9 +28,9 @@ BEGIN
END IF; END IF;
sqlins := 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_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 || 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 ' || ' 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; || roleaccesslevelwin;
@ -39,9 +39,9 @@ BEGIN
EXECUTE IMMEDIATE sqlins; EXECUTE IMMEDIATE sqlins;
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_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 || r.ad_role_id
|| ' AND p.AD_Process_ID = pa.AD_Process_ID) WHERE pa.AD_Process_ID IS NULL AND AccessLevel IN ' || ' AND p.AD_Process_ID = pa.AD_Process_ID) WHERE pa.AD_Process_ID IS NULL AND AccessLevel IN '
|| roleaccesslevel; || roleaccesslevel;
@ -50,9 +50,9 @@ BEGIN
EXECUTE IMMEDIATE sqlins; EXECUTE IMMEDIATE sqlins;
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_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 || r.ad_role_id
|| ' AND f.AD_Form_ID = fa.AD_Form_ID) WHERE fa.AD_Form_ID IS NULL AND AccessLevel IN ' || ' AND f.AD_Form_ID = fa.AD_Form_ID) WHERE fa.AD_Form_ID IS NULL AND AccessLevel IN '
|| roleaccesslevel; || roleaccesslevel;
@ -61,9 +61,9 @@ BEGIN
EXECUTE IMMEDIATE sqlins; EXECUTE IMMEDIATE sqlins;
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_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 || 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 ' || ' 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; || roleaccesslevel;
@ -72,9 +72,9 @@ BEGIN
EXECUTE IMMEDIATE sqlins; EXECUTE IMMEDIATE sqlins;
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 || 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=' || ' 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 || r.ad_role_id
|| ') LEFT JOIN AD_Document_Action_Access da ON (da.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); -- DBMS_OUTPUT.PUT_LINE (sqlins);
EXECUTE IMMEDIATE 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; END LOOP;
COMMIT; COMMIT;

View File

@ -65,5 +65,3 @@ $func$ LANGUAGE plpgsql;
select add_missing_translations(); select add_missing_translations();
commit;

View File

@ -126,4 +126,3 @@ $func$ LANGUAGE plpgsql;
select update_sequences(); select update_sequences();
commit;

View File

@ -7,7 +7,7 @@ DECLARE
BEGIN BEGIN
FOR r IN (SELECT ad_role_id, userlevel, NAME, ad_client_id, ad_org_id FOR r IN (SELECT ad_role_id, userlevel, NAME, ad_client_id, ad_org_id
FROM AD_ROLE FROM AD_ROLE
WHERE ismanual = 'N' WHERE ismanual = 'N' AND isactive = 'Y'
ORDER BY ad_role_id) ORDER BY ad_role_id)
LOOP LOOP
IF r.userlevel = 'S ' -- system IF r.userlevel = 'S ' -- system
@ -29,9 +29,9 @@ BEGIN
END IF; END IF;
sqlins := 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_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 || 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 ' || ' 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; || roleaccesslevelwin;
@ -39,9 +39,9 @@ BEGIN
EXECUTE sqlins; EXECUTE sqlins;
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_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 || r.ad_role_id
|| ' AND p.AD_Process_ID = pa.AD_Process_ID) WHERE pa.AD_Process_ID IS NULL AND AccessLevel IN ' || ' AND p.AD_Process_ID = pa.AD_Process_ID) WHERE pa.AD_Process_ID IS NULL AND AccessLevel IN '
|| roleaccesslevel; || roleaccesslevel;
@ -49,9 +49,9 @@ BEGIN
EXECUTE sqlins; EXECUTE sqlins;
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_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 || r.ad_role_id
|| ' AND f.AD_Form_ID = fa.AD_Form_ID) WHERE fa.AD_Form_ID IS NULL AND AccessLevel IN ' || ' AND f.AD_Form_ID = fa.AD_Form_ID) WHERE fa.AD_Form_ID IS NULL AND AccessLevel IN '
|| roleaccesslevel; || roleaccesslevel;
@ -59,9 +59,9 @@ BEGIN
EXECUTE sqlins; EXECUTE sqlins;
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_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 || 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 ' || ' 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; || roleaccesslevel;
@ -69,9 +69,9 @@ BEGIN
EXECUTE sqlins; EXECUTE sqlins;
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 || 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=' || ' 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 || r.ad_role_id
|| ') LEFT JOIN AD_Document_Action_Access da ON (da.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))'; || ' 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; 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 LOOP;
END; END;
@ -86,4 +96,3 @@ $func$ LANGUAGE plpgsql;
select role_access_update(); select role_access_update();
commit;

View File

@ -486,6 +486,7 @@ public abstract class Convert
"AD_CHANGELOG", "AD_CHANGELOG",
"AD_DOCUMENT_ACTION_ACCESS", "AD_DOCUMENT_ACTION_ACCESS",
"AD_FORM_ACCESS", "AD_FORM_ACCESS",
"AD_INFOWINDOW_ACCESS",
"AD_ISSUE", "AD_ISSUE",
"AD_LDAPPROCESSORLOG", "AD_LDAPPROCESSORLOG",
"AD_PACKAGE_IMP", "AD_PACKAGE_IMP",

View File

@ -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) " + " 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)) "; + "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 * 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 form = DB.executeUpdateEx(sqlForm + roleAccessLevel, get_TrxName());
int wf = DB.executeUpdateEx(sqlWorkflow + roleAccessLevel, get_TrxName()); int wf = DB.executeUpdateEx(sqlWorkflow + roleAccessLevel, get_TrxName());
int docact = DB.executeUpdateEx(sqlDocAction, get_TrxName()); int docact = DB.executeUpdateEx(sqlDocAction, get_TrxName());
int info = DB.executeUpdateEx(sqlInfo, get_TrxName());
loadAccess(true); loadAccess(true);
return "@AD_Window_ID@ #" + win return "@AD_Window_ID@ #" + win
+ " - @AD_Process_ID@ #" + proc + " - @AD_Process_ID@ #" + proc
+ " - @AD_Form_ID@ #" + form + " - @AD_Form_ID@ #" + form
+ " - @AD_Workflow_ID@ #" + wf + " - @AD_Workflow_ID@ #" + wf
+ " - @DocAction@ #" + docact; + " - @DocAction@ #" + docact
+ " - @AD_InfoWindow_ID@ #" + info;
} // createAccessRecords } // 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 formDel = DB.executeUpdateEx("DELETE FROM AD_Form_Access" + whereDel, get_TrxName());
int wfDel = DB.executeUpdateEx("DELETE FROM AD_WorkFlow_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 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 if (log.isLoggable(Level.FINE)) log.fine("AD_Window_Access=" + winDel
+ ", AD_Process_Access=" + procDel + ", AD_Process_Access=" + procDel
+ ", AD_Form_Access=" + formDel + ", AD_Form_Access=" + formDel
+ ", AD_Workflow_Access=" + wfDel + ", 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<Integer,Boolean> m_workflowAccess = null; private HashMap<Integer,Boolean> m_workflowAccess = null;
/** Form Access */ /** Form Access */
private HashMap<Integer,Boolean> m_formAccess = null; private HashMap<Integer,Boolean> m_formAccess = null;
/** Info Windows */
private HashMap<Integer, Boolean> m_infoAccess;
/** /**
* Set Logged in user * Set Logged in user
@ -2784,7 +2799,6 @@ public final class MRole extends X_AD_Role
} }
private int m_includedSeqNo = -1; private int m_includedSeqNo = -1;
private HashMap<Integer, Boolean> m_infoAccess;
/** /**
* Merge permissions access * Merge permissions access