IDEMPIERE-893 Use AD_InfoWindow_Access instead of DPViews for access to info windows / Based on patch from Juliana Corredor

This commit is contained in:
Carlos Ruiz 2013-06-17 19:16:30 -05:00
parent 470202287c
commit 09a39bab52
6 changed files with 242 additions and 75 deletions

View File

@ -0,0 +1,100 @@
-- Jun 14, 2013 6:22:47 PM COT
-- IDEMPIERE-893 Use AD_InfoWindow_Access instead of DPViews for access to info windows
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_DATE('2013-06-14 18:22:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50176
;
-- Jun 14, 2013 6:22:57 PM COT
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_DATE('2013-06-14 18:22:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50170
;
-- Jun 14, 2013 6:23:06 PM COT
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_DATE('2013-06-14 18:23:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50169
;
-- Jun 14, 2013 6:23:17 PM COT
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_DATE('2013-06-14 18:23:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50172
;
-- Jun 14, 2013 6:23:27 PM COT
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_DATE('2013-06-14 18:23:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50173
;
-- Jun 14, 2013 6:23:37 PM COT
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_DATE('2013-06-14 18:23:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50174
;
-- Jun 14, 2013 6:23:50 PM COT
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_DATE('2013-06-14 18:23:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50175
;
-- Jun 14, 2013 6:24:04 PM COT
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_DATE('2013-06-14 18:24:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50177
;
-- Jun 17, 2013 6:34:24 PM COT
UPDATE AD_Field SET SeqNo=300, IsDisplayed='Y', XPosition=5,Updated=TO_DATE('2013-06-17 18:34:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50178
;
-- Jun 17, 2013 6:34:24 PM COT
UPDATE AD_Field SET SeqNo=310, AD_FieldGroup_ID=50000, IsDisplayed='Y', XPosition=2,Updated=TO_DATE('2013-06-17 18:34:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50176
;
-- Jun 17, 2013 6:34:24 PM COT
UPDATE AD_Field SET SeqNo=320, IsDisplayed='Y', XPosition=5,Updated=TO_DATE('2013-06-17 18:34:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50170
;
-- Jun 17, 2013 6:34:24 PM COT
UPDATE AD_Field SET SeqNo=330, IsDisplayed='Y', XPosition=2,Updated=TO_DATE('2013-06-17 18:34:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50174
;
-- Jun 17, 2013 6:34:25 PM COT
UPDATE AD_Field SET SeqNo=350, IsDisplayed='Y', XPosition=2,Updated=TO_DATE('2013-06-17 18:34:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50172
;
-- Jun 17, 2013 6:34:25 PM COT
UPDATE AD_Field SET SeqNo=370, IsDisplayed='Y', XPosition=2,Updated=TO_DATE('2013-06-17 18:34:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50169
;
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('20130617121500_IDEMPIERE-893.sql') FROM dual
;

View File

@ -0,0 +1,100 @@
-- Jun 14, 2013 6:22:47 PM COT
-- IDEMPIERE-893 Use AD_InfoWindow_Access instead of DPViews for access to info windows
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_TIMESTAMP('2013-06-14 18:22:47','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50176
;
-- Jun 14, 2013 6:22:57 PM COT
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_TIMESTAMP('2013-06-14 18:22:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50170
;
-- Jun 14, 2013 6:23:06 PM COT
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_TIMESTAMP('2013-06-14 18:23:06','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50169
;
-- Jun 14, 2013 6:23:17 PM COT
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_TIMESTAMP('2013-06-14 18:23:17','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50172
;
-- Jun 14, 2013 6:23:27 PM COT
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_TIMESTAMP('2013-06-14 18:23:27','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50173
;
-- Jun 14, 2013 6:23:37 PM COT
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_TIMESTAMP('2013-06-14 18:23:37','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50174
;
-- Jun 14, 2013 6:23:50 PM COT
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_TIMESTAMP('2013-06-14 18:23:50','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50175
;
-- Jun 14, 2013 6:24:04 PM COT
UPDATE AD_Field SET DisplayLogic='@IsMasterRole@=N & @#UIClient@=''swing''',Updated=TO_TIMESTAMP('2013-06-14 18:24:04','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50177
;
-- Jun 17, 2013 6:34:24 PM COT
UPDATE AD_Field SET SeqNo=300, IsDisplayed='Y', XPosition=5,Updated=TO_TIMESTAMP('2013-06-17 18:34:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50178
;
-- Jun 17, 2013 6:34:24 PM COT
UPDATE AD_Field SET SeqNo=310, AD_FieldGroup_ID=50000, IsDisplayed='Y', XPosition=2,Updated=TO_TIMESTAMP('2013-06-17 18:34:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50176
;
-- Jun 17, 2013 6:34:24 PM COT
UPDATE AD_Field SET SeqNo=320, IsDisplayed='Y', XPosition=5,Updated=TO_TIMESTAMP('2013-06-17 18:34:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50170
;
-- Jun 17, 2013 6:34:24 PM COT
UPDATE AD_Field SET SeqNo=330, IsDisplayed='Y', XPosition=2,Updated=TO_TIMESTAMP('2013-06-17 18:34:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50174
;
-- Jun 17, 2013 6:34:25 PM COT
UPDATE AD_Field SET SeqNo=350, IsDisplayed='Y', XPosition=2,Updated=TO_TIMESTAMP('2013-06-17 18:34:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50172
;
-- Jun 17, 2013 6:34:25 PM COT
UPDATE AD_Field SET SeqNo=370, IsDisplayed='Y', XPosition=2,Updated=TO_TIMESTAMP('2013-06-17 18:34:25','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50169
;
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('20130617121500_IDEMPIERE-893.sql') FROM dual
;

View File

@ -59,14 +59,20 @@ public class MInfoWindow extends X_AD_InfoWindow
} // MInfoWindow } // MInfoWindow
public static MInfoWindow get(String tableName, String trxName) { public static MInfoWindow get(String tableName, String trxName) {
Query query = new Query(Env.getCtx(), MTable.get(Env.getCtx(), I_AD_InfoWindow.Table_ID), I_AD_InfoWindow.COLUMNNAME_AD_Table_ID+"=? AND IsValid='Y' ", null); Query query = new Query(Env.getCtx(), MTable.get(Env.getCtx(), MInfoWindow.Table_ID), MInfoWindow.COLUMNNAME_AD_Table_ID+"=? AND IsValid='Y' ", null);
MTable table = MTable.get(Env.getCtx(), tableName); MTable table = MTable.get(Env.getCtx(), tableName);
if (table != null) { if (table != null) {
return query.setParameters(table.getAD_Table_ID()) List<MInfoWindow> iws = query.setParameters(table.getAD_Table_ID())
.setOrderBy("AD_Client_ID Desc, AD_Org_ID Desc, IsDefault Desc, AD_InfoWindow_ID Desc") .setOrderBy("AD_Client_ID Desc, AD_Org_ID Desc, IsDefault Desc, AD_InfoWindow_ID Desc")
.setOnlyActiveRecords(true) .setOnlyActiveRecords(true)
.setApplyAccessFilter(true) .setApplyAccessFilter(true)
.first(); .list();
// verify role has access and return the first with access / IDEMPIERE-893
for (MInfoWindow iw : iws) {
Boolean access = MRole.getDefault().getInfoAccess(iw.getAD_InfoWindow_ID());
if (access != null && access.booleanValue())
return iw;
}
} }
return null; return null;
} }

View File

@ -21,7 +21,7 @@
<stringAttribute key="pde.version" value="3.3"/> <stringAttribute key="pde.version" value="3.3"/>
<stringAttribute key="product" value="org.adempiere.ui.swing.client_product"/> <stringAttribute key="product" value="org.adempiere.ui.swing.client_product"/>
<stringAttribute key="productFile" value="/org.adempiere.ui.swing-feature/swingclient.product"/> <stringAttribute key="productFile" value="/org.adempiere.ui.swing-feature/swingclient.product"/>
<stringAttribute key="selected_target_plugins" value="com.springsource.javax.ejb@default:default,com.springsource.javax.jms@default:default,com.springsource.javax.mail@default:default,com.springsource.javax.management.j2ee@default:default,com.springsource.javax.persistence@default:default,com.springsource.javax.transaction@default:default,com.springsource.javax.xml.rpc@default:default,com.springsource.javax.xml.soap@default:default,com.springsource.net.sf.cglib@default:default,com.springsource.org.aopalliance@default:default,com.springsource.org.apache.activemq@default:default,com.springsource.org.apache.commons.logging@default:default,com.springsource.org.apache.kahadb@default:default,com.springsource.org.apache.xmlcommons@default:default,com.springsource.slf4j.api@default:default,com.springsource.slf4j.jcl@default:false,com.springsource.slf4j.nop@default:false,javax.el@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.batik.bridge@default:default,org.apache.batik.css@default:default,org.apache.batik.dom.svg@default:default,org.apache.batik.dom@default:default,org.apache.batik.ext.awt@default:default,org.apache.batik.extension@default:default,org.apache.batik.parser@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.batik.xml@default:default,org.apache.commons.codec@default:default,org.apache.commons.collections@default:default,org.apache.commons.httpclient@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.poi@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.ecf@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@3:true,org.eclipse.equinox.event@3:true,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.launcher.gtk.linux.x86_64@default:false,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.equinox.p2.ql@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.equinox.util@default:default,org.eclipse.osgi.services@3:true,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.junit@default:default,org.restlet*2.1.0.v20130114-0123@default:true,org.restlet.ext.net*2.1.0.v20130114-0123@default:true,org.restlet.ext.servlet*2.1.0.v20130114-0123@default:default,org.restlet.ext.ssl@default:default,org.sat4j.core@default:default,org.sat4j.pb@default:default,org.springframework.aop@default:default,org.springframework.beans@default:default,org.springframework.context@default:default,org.springframework.core@default:default,org.w3c.css.sac@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/> <stringAttribute key="selected_target_plugins" value="com.springsource.javax.ejb@default:default,com.springsource.javax.jms@default:default,com.springsource.javax.mail@default:default,com.springsource.javax.management.j2ee@default:default,com.springsource.javax.persistence@default:default,com.springsource.javax.transaction@default:default,com.springsource.javax.xml.rpc@default:default,com.springsource.javax.xml.soap@default:default,com.springsource.net.sf.cglib@default:default,com.springsource.org.aopalliance@default:default,com.springsource.org.apache.activemq@default:default,com.springsource.org.apache.commons.logging@default:default,com.springsource.org.apache.kahadb@default:default,com.springsource.slf4j.api@default:default,com.springsource.slf4j.jcl@default:false,com.springsource.slf4j.nop@default:false,javax.el@default:default,javax.servlet@default:default,javax.xml@default:default,org.apache.ant@default:default,org.apache.batik.bridge@default:default,org.apache.batik.css@default:default,org.apache.batik.dom.svg@default:default,org.apache.batik.dom@default:default,org.apache.batik.ext.awt@default:default,org.apache.batik.extension@default:default,org.apache.batik.parser@default:default,org.apache.batik.util.gui@default:default,org.apache.batik.util@default:default,org.apache.batik.xml@default:default,org.apache.commons.codec@default:default,org.apache.commons.collections@default:default,org.apache.commons.httpclient@default:default,org.apache.commons.logging@default:default,org.apache.commons.net@default:default,org.apache.poi@default:default,org.apache.xerces@default:default,org.apache.xml.resolver@default:default,org.apache.xml.serializer@default:default,org.eclipse.ant.core@default:default,org.eclipse.core.contenttype@default:default,org.eclipse.core.jobs@default:default,org.eclipse.core.net@default:default,org.eclipse.core.runtime.compatibility.auth@default:default,org.eclipse.core.runtime@default:true,org.eclipse.core.variables@default:default,org.eclipse.ecf.filetransfer@default:default,org.eclipse.ecf.identity@default:default,org.eclipse.ecf.provider.filetransfer.httpclient.ssl@default:false,org.eclipse.ecf.provider.filetransfer.httpclient@default:default,org.eclipse.ecf.provider.filetransfer.ssl@default:false,org.eclipse.ecf.provider.filetransfer@default:default,org.eclipse.ecf.ssl@default:false,org.eclipse.ecf@default:default,org.eclipse.equinox.app@default:default,org.eclipse.equinox.common@2:true,org.eclipse.equinox.ds@3:true,org.eclipse.equinox.event@3:true,org.eclipse.equinox.frameworkadmin.equinox@default:default,org.eclipse.equinox.frameworkadmin@default:default,org.eclipse.equinox.http.registry@default:default,org.eclipse.equinox.launcher.gtk.linux.x86_64@default:false,org.eclipse.equinox.launcher@default:default,org.eclipse.equinox.p2.artifact.repository@default:default,org.eclipse.equinox.p2.console@default:default,org.eclipse.equinox.p2.core@default:default,org.eclipse.equinox.p2.director@default:default,org.eclipse.equinox.p2.engine@default:default,org.eclipse.equinox.p2.garbagecollector@default:default,org.eclipse.equinox.p2.jarprocessor@default:default,org.eclipse.equinox.p2.metadata.repository@default:default,org.eclipse.equinox.p2.metadata@default:default,org.eclipse.equinox.p2.publisher@default:default,org.eclipse.equinox.p2.ql@default:default,org.eclipse.equinox.p2.repository@default:default,org.eclipse.equinox.p2.touchpoint.eclipse@default:default,org.eclipse.equinox.p2.touchpoint.natives@default:default,org.eclipse.equinox.preferences@default:default,org.eclipse.equinox.registry@default:default,org.eclipse.equinox.security@default:default,org.eclipse.equinox.simpleconfigurator.manipulator@default:default,org.eclipse.equinox.simpleconfigurator@1:true,org.eclipse.equinox.util@default:default,org.eclipse.osgi.services@3:true,org.eclipse.osgi@-1:true,org.hamcrest.core@default:default,org.junit@default:default,org.restlet.ext.net@default:true,org.restlet.ext.servlet@default:default,org.restlet.ext.ssl@default:default,org.restlet@default:true,org.sat4j.core@default:default,org.sat4j.pb@default:default,org.springframework.aop@default:default,org.springframework.beans@default:default,org.springframework.context@default:default,org.springframework.core@default:default,org.w3c.css.sac@default:default,org.w3c.dom.smil@default:default,org.w3c.dom.svg@default:default"/>
<stringAttribute key="selected_workspace_plugins" value="org.adempiere.base.callout@default:default,org.adempiere.base.process@default:default,org.adempiere.base@4:true,org.adempiere.extend@default:false,org.adempiere.install@default:default,org.adempiere.payment.processor@default:default,org.adempiere.pipo.handlers@default:default,org.adempiere.pipo@default:default,org.adempiere.plugin.utils@default:default,org.adempiere.replication@default:default,org.adempiere.report.jasper.library@default:default,org.adempiere.report.jasper.swing@default:default,org.adempiere.report.jasper@default:default,org.adempiere.ui.swing@default:default,org.adempiere.ui@default:default,org.apache.ecs@default:default,org.compiere.db.oracle.provider@default:default,org.compiere.db.postgresql.provider@default:default,org.idempiere.hazelcast.service.config@default:false,org.idempiere.hazelcast.service@default:true,org.idempiere.webservices@default:default,org.w3c.dom.fragment@default:false"/> <stringAttribute key="selected_workspace_plugins" value="org.adempiere.base.callout@default:default,org.adempiere.base.process@default:default,org.adempiere.base@4:true,org.adempiere.extend@default:false,org.adempiere.install@default:default,org.adempiere.payment.processor@default:default,org.adempiere.pipo.handlers@default:default,org.adempiere.pipo@default:default,org.adempiere.plugin.utils@default:default,org.adempiere.replication@default:default,org.adempiere.report.jasper.library@default:default,org.adempiere.report.jasper.swing@default:default,org.adempiere.report.jasper@default:default,org.adempiere.ui.swing@default:default,org.adempiere.ui@default:default,org.apache.ecs@default:default,org.compiere.db.oracle.provider@default:default,org.compiere.db.postgresql.provider@default:default,org.idempiere.hazelcast.service.config@default:false,org.idempiere.hazelcast.service@default:true,org.idempiere.webservices@default:default,org.w3c.dom.fragment@default:false"/>
<booleanAttribute key="show_selected_only" value="false"/> <booleanAttribute key="show_selected_only" value="false"/>
<booleanAttribute key="tracing" value="false"/> <booleanAttribute key="tracing" value="false"/>

View File

@ -369,52 +369,6 @@ public final class AEnv
CacheMgt.get().reset(tableName, Record_ID); CacheMgt.get().reset(tableName, Record_ID);
} // cacheReset } // cacheReset
/**
* Validate permissions to access Info queries on the view menu
* @author kstan_79
* @return true if access is allowed
*/
public static boolean canAccessInfo(String infoWindowName)
{
boolean result=false;
int roleid= Env.getAD_Role_ID(Env.getCtx());
String sqlRolePermission="Select COUNT(AD_ROLE_ID) AS ROWCOUNT FROM AD_ROLE WHERE AD_ROLE_ID=" + roleid
+ " AND ALLOW_INFO_" + infoWindowName + "='Y'";
log.config(sqlRolePermission);
PreparedStatement prolestmt = null;
ResultSet rs = null;
try
{
prolestmt = DB.prepareStatement (sqlRolePermission, null);
rs = prolestmt.executeQuery ();
rs.next();
if (rs.getInt("ROWCOUNT")>0)
{
result=true;
}
else
{
return false;
}
}
catch (Exception e)
{
log.log(Level.SEVERE, "(1)", e);
}
finally
{
DB.close(rs, prolestmt);
}
return result;
} // canAccessInfo
public static void actionRefresh(Lookup lookup, Object value, boolean mandatory, boolean shortList) // IDEMPIERE 90 public static void actionRefresh(Lookup lookup, Object value, boolean mandatory, boolean shortList) // IDEMPIERE 90
{ {
if (lookup == null) if (lookup == null)

View File

@ -19,6 +19,15 @@ import org.adempiere.webui.component.Window;
import org.adempiere.webui.panel.InfoPanel; import org.adempiere.webui.panel.InfoPanel;
import org.adempiere.webui.theme.ThemeManager; import org.adempiere.webui.theme.ThemeManager;
import org.adempiere.webui.window.InfoSchedule; import org.adempiere.webui.window.InfoSchedule;
import org.compiere.model.I_A_Asset;
import org.compiere.model.I_C_BPartner;
import org.compiere.model.I_C_Invoice;
import org.compiere.model.I_C_Order;
import org.compiere.model.I_C_Payment;
import org.compiere.model.I_M_InOut;
import org.compiere.model.I_M_Product;
import org.compiere.model.I_S_ResourceAssignment;
import org.compiere.model.MInfoWindow;
import org.compiere.model.MRole; import org.compiere.model.MRole;
import org.compiere.util.Env; import org.compiere.util.Env;
import org.compiere.util.Msg; import org.compiere.util.Msg;
@ -53,8 +62,8 @@ public class DPViews extends DashboardPanel implements EventListener<Event> {
private Box createViewPanel() private Box createViewPanel()
{ {
Vbox vbox = new Vbox(); Vbox vbox = new Vbox();
if (MRole.getDefault().isAllow_Info_Product()) if (MInfoWindow.get(I_M_Product.Table_Name, null) != null)
{ {
ToolBarButton btnViewItem = new ToolBarButton("InfoProduct"); ToolBarButton btnViewItem = new ToolBarButton("InfoProduct");
btnViewItem.setSclass("link"); btnViewItem.setSclass("link");
@ -63,7 +72,7 @@ public class DPViews extends DashboardPanel implements EventListener<Event> {
btnViewItem.addEventListener(Events.ON_CLICK, this); btnViewItem.addEventListener(Events.ON_CLICK, this);
vbox.appendChild(btnViewItem); vbox.appendChild(btnViewItem);
} }
if (MRole.getDefault().isAllow_Info_BPartner()) if (MInfoWindow.get(I_C_BPartner.Table_Name, null) != null)
{ {
ToolBarButton btnViewItem = new ToolBarButton("InfoBPartner"); ToolBarButton btnViewItem = new ToolBarButton("InfoBPartner");
btnViewItem.setSclass("link"); btnViewItem.setSclass("link");
@ -91,7 +100,7 @@ public class DPViews extends DashboardPanel implements EventListener<Event> {
vbox.appendChild(btnViewItem); vbox.appendChild(btnViewItem);
} }
vbox.appendChild(new Separator("horizontal")); vbox.appendChild(new Separator("horizontal"));
if (MRole.getDefault().isAllow_Info_Order()) if (MInfoWindow.get(I_C_Order.Table_Name, null) != null)
{ {
ToolBarButton btnViewItem = new ToolBarButton("InfoOrder"); ToolBarButton btnViewItem = new ToolBarButton("InfoOrder");
btnViewItem.setSclass("link"); btnViewItem.setSclass("link");
@ -100,7 +109,7 @@ public class DPViews extends DashboardPanel implements EventListener<Event> {
btnViewItem.addEventListener(Events.ON_CLICK, this); btnViewItem.addEventListener(Events.ON_CLICK, this);
vbox.appendChild(btnViewItem); vbox.appendChild(btnViewItem);
} }
if (MRole.getDefault().isAllow_Info_Invoice()) if (MInfoWindow.get(I_C_Invoice.Table_Name, null) != null)
{ {
ToolBarButton btnViewItem = new ToolBarButton("InfoInvoice"); ToolBarButton btnViewItem = new ToolBarButton("InfoInvoice");
btnViewItem.setSclass("link"); btnViewItem.setSclass("link");
@ -109,7 +118,7 @@ public class DPViews extends DashboardPanel implements EventListener<Event> {
btnViewItem.addEventListener(Events.ON_CLICK, this); btnViewItem.addEventListener(Events.ON_CLICK, this);
vbox.appendChild(btnViewItem); vbox.appendChild(btnViewItem);
} }
if (MRole.getDefault().isAllow_Info_InOut()) if (MInfoWindow.get(I_M_InOut.Table_Name, null) != null)
{ {
ToolBarButton btnViewItem = new ToolBarButton("InfoInOut"); ToolBarButton btnViewItem = new ToolBarButton("InfoInOut");
btnViewItem.setSclass("link"); btnViewItem.setSclass("link");
@ -118,7 +127,7 @@ public class DPViews extends DashboardPanel implements EventListener<Event> {
btnViewItem.addEventListener(Events.ON_CLICK, this); btnViewItem.addEventListener(Events.ON_CLICK, this);
vbox.appendChild(btnViewItem); vbox.appendChild(btnViewItem);
} }
if (MRole.getDefault().isAllow_Info_Payment()) if (MInfoWindow.get(I_C_Payment.Table_Name, null) != null)
{ {
ToolBarButton btnViewItem = new ToolBarButton("InfoPayment"); ToolBarButton btnViewItem = new ToolBarButton("InfoPayment");
btnViewItem.setSclass("link"); btnViewItem.setSclass("link");
@ -135,7 +144,7 @@ public class DPViews extends DashboardPanel implements EventListener<Event> {
// btnViewItem.addEventListener(Events.ON_CLICK, this); // btnViewItem.addEventListener(Events.ON_CLICK, this);
// vbox.appendChild(btnViewItem); // vbox.appendChild(btnViewItem);
// } // }
if (MRole.getDefault().isAllow_Info_Resource()) if (MInfoWindow.get(I_S_ResourceAssignment.Table_Name, null) != null)
{ {
ToolBarButton btnViewItem = new ToolBarButton("InfoAssignment"); ToolBarButton btnViewItem = new ToolBarButton("InfoAssignment");
btnViewItem.setSclass("link"); btnViewItem.setSclass("link");
@ -144,7 +153,7 @@ public class DPViews extends DashboardPanel implements EventListener<Event> {
btnViewItem.addEventListener(Events.ON_CLICK, this); btnViewItem.addEventListener(Events.ON_CLICK, this);
vbox.appendChild(btnViewItem); vbox.appendChild(btnViewItem);
} }
if (MRole.getDefault().isAllow_Info_Asset()) if (MInfoWindow.get(I_A_Asset.Table_Name, null) != null)
{ {
ToolBarButton btnViewItem = new ToolBarButton("InfoAsset"); ToolBarButton btnViewItem = new ToolBarButton("InfoAsset");
btnViewItem.setSclass("link"); btnViewItem.setSclass("link");
@ -170,51 +179,49 @@ public class DPViews extends DashboardPanel implements EventListener<Event> {
String actionCommand = btn.getName(); String actionCommand = btn.getName();
int WindowNo = 0; int WindowNo = 0;
if (actionCommand.equals("InfoProduct") && AEnv.canAccessInfo("PRODUCT")) if (actionCommand.equals("InfoProduct"))
{ {
InfoPanel.showProduct(WindowNo); InfoPanel.showProduct(WindowNo);
} }
else if (actionCommand.equals("InfoBPartner") && AEnv.canAccessInfo("BPARTNER")) else if (actionCommand.equals("InfoBPartner"))
{ {
InfoPanel.showBPartner(WindowNo); InfoPanel.showBPartner(WindowNo);
} }
else if (actionCommand.equals("InfoAsset") && AEnv.canAccessInfo("ASSET")) else if (actionCommand.equals("InfoAsset"))
{ {
InfoPanel.showAsset(WindowNo); InfoPanel.showAsset(WindowNo);
} }
else if (actionCommand.equals("InfoAccount") && else if (actionCommand.equals("InfoAccount"))
MRole.getDefault().isShowAcct() &&
AEnv.canAccessInfo("ACCOUNT"))
{ {
new org.adempiere.webui.acct.WAcctViewer(); new org.adempiere.webui.acct.WAcctViewer();
} }
else if (actionCommand.equals("InfoSchedule") && AEnv.canAccessInfo("SCHEDULE")) else if (actionCommand.equals("InfoSchedule"))
{ {
InfoSchedule is = new InfoSchedule(null, false); InfoSchedule is = new InfoSchedule(null, false);
is.setAttribute(Window.MODE_KEY, Mode.EMBEDDED); is.setAttribute(Window.MODE_KEY, Mode.EMBEDDED);
AEnv.showWindow(is); AEnv.showWindow(is);
} }
else if (actionCommand.equals("InfoOrder") && AEnv.canAccessInfo("ORDER")) else if (actionCommand.equals("InfoOrder"))
{ {
InfoPanel.showOrder(WindowNo, ""); InfoPanel.showOrder(WindowNo, "");
} }
else if (actionCommand.equals("InfoInvoice") && AEnv.canAccessInfo("INVOICE")) else if (actionCommand.equals("InfoInvoice"))
{ {
InfoPanel.showInvoice(WindowNo, ""); InfoPanel.showInvoice(WindowNo, "");
} }
else if (actionCommand.equals("InfoInOut") && AEnv.canAccessInfo("INOUT")) else if (actionCommand.equals("InfoInOut"))
{ {
InfoPanel.showInOut(WindowNo, ""); InfoPanel.showInOut(WindowNo, "");
} }
else if (actionCommand.equals("InfoPayment") && AEnv.canAccessInfo("PAYMENT")) else if (actionCommand.equals("InfoPayment"))
{ {
InfoPanel.showPayment(WindowNo, ""); InfoPanel.showPayment(WindowNo, "");
} }
else if (actionCommand.equals("InfoCashLine") && AEnv.canAccessInfo("CASHJOURNAL")) // else if (actionCommand.equals("InfoCashLine"))
{ // {
InfoPanel.showCashLine(WindowNo, ""); // InfoPanel.showCashLine(WindowNo, "");
} // }
else if (actionCommand.equals("InfoAssignment") && AEnv.canAccessInfo("RESOURCE")) else if (actionCommand.equals("InfoAssignment"))
{ {
InfoPanel.showAssignment(WindowNo, ""); InfoPanel.showAssignment(WindowNo, "");
} }