IDEMPIERE-1859 Info Window access are based on the table and not on the InfoWindowID

This commit is contained in:
Nicolas Micoud 2014-09-05 16:48:44 -05:00
parent b825c289b4
commit 6ca4902204
2 changed files with 11 additions and 3 deletions

View File

@ -42,7 +42,7 @@ public class MInfoWindow extends X_AD_InfoWindow
/**
*
*/
private static final long serialVersionUID = -3099366897275960300L;
private static final long serialVersionUID = -3627504150648422756L;
/**
* Standard Constructor
@ -178,6 +178,15 @@ public class MInfoWindow extends X_AD_InfoWindow
}
/** return true if the current role can access to the specified info window ; otherwise return null */
public static MInfoWindow get(int infoWindowID, String trxName) {
MInfoWindow iw = new MInfoWindow(Env.getCtx(), infoWindowID, null);
Boolean access = MRole.getDefault().getInfoAccess(iw.getAD_InfoWindow_ID());
if (access != null && access.booleanValue())
return iw;
return null;
}
public MInfoColumn[] getInfoColumns(TableInfo[] tableInfos) {
Query query = new Query(getCtx(), MTable.get(getCtx(), I_AD_InfoColumn.Table_ID), I_AD_InfoColumn.COLUMNNAME_AD_InfoWindow_ID+"=?", get_TrxName());
List<MInfoColumn> list = query.setParameters(getAD_InfoWindow_ID())

View File

@ -24,7 +24,6 @@ import org.adempiere.webui.window.InfoSchedule;
import org.compiere.model.MInfoWindow;
import org.compiere.model.MRole;
import org.compiere.model.MSysConfig;
import org.compiere.model.MTable;
import org.compiere.model.Query;
import org.compiere.util.Env;
import org.compiere.util.Msg;
@ -90,7 +89,7 @@ public class DPViews extends DashboardPanel implements EventListener<Event> {
for (int i = 0; i < infos.length; i++)
{
MInfoWindow info = infos[i];
if (MInfoWindow.get(MTable.getTableName(Env.getCtx(), info.getAD_Table_ID()), null) != null)
if (MInfoWindow.get(info.getAD_InfoWindow_ID(), null) != null)
{
ToolBarButton btnViewItem = new ToolBarButton(info.getName());
btnViewItem.setSclass("link");