IDEMPIERE-2275 Process button of toolbar doesn't handle access / based on patch from Nicolas Micoud (nmicoud)

This commit is contained in:
Carlos Ruiz 2014-10-29 11:17:45 -05:00
parent dbc3ef550d
commit 5c27c2bf3d
3 changed files with 10 additions and 5 deletions

View File

@ -170,8 +170,8 @@ public class MInfoWindow extends X_AD_InfoWindow
Iterator<MInfoProcess> iterator = lsInfoProcess.iterator();
while (iterator.hasNext()){
MInfoProcess testInfoProcess = iterator.next();
// need more review
if (MRole.getDefault().getProcessAccess(testInfoProcess.getAD_Process_ID()) == null){
Boolean access = MRole.getDefault().getProcessAccess(testInfoProcess.getAD_Process_ID());
if (access == null || !access.booleanValue()) {
iterator.remove();
}
}

View File

@ -57,7 +57,8 @@ public class ExecuteProcessCommand extends ServerResource {
String procedureName = (String) entity.get("procedureName");
MRole role = MRole.get(context, Env.getAD_Role_ID(context), Env.getAD_User_ID(context), false);
if (!role.getProcessAccess(pi.getAD_Process_ID())) {
Boolean access = role.getProcessAccess(pi.getAD_Process_ID());
if (access == null || !access.booleanValue()) {
throw new AdempiereException("Access denied.");
}

View File

@ -62,6 +62,7 @@ import org.compiere.model.GridWindow;
import org.compiere.model.I_AD_Preference;
import org.compiere.model.MLookup;
import org.compiere.model.MPreference;
import org.compiere.model.MRole;
import org.compiere.model.MTab;
import org.compiere.model.MTable;
import org.compiere.model.MToolBarButton;
@ -632,8 +633,11 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
//get extra toolbar process buttons
MToolBarButton[] mToolbarButtons = MToolBarButton.getProcessButtonOfTab(gridTab.getAD_Tab_ID(), null);
for(MToolBarButton mToolbarButton : mToolbarButtons) {
ToolbarProcessButton toolbarProcessButton = new ToolbarProcessButton(mToolbarButton, this, windowPanel, windowNo);
toolbarProcessButtons.add(toolbarProcessButton);
Boolean access = MRole.getDefault().getProcessAccess(mToolbarButton.getAD_Process_ID());
if (access != null && access.booleanValue()) {
ToolbarProcessButton toolbarProcessButton = new ToolbarProcessButton(mToolbarButton, this, windowPanel, windowNo);
toolbarProcessButtons.add(toolbarProcessButton);
}
}
if (toolbarProcessButtons.size() > 0) {