IDEMPIERE-2275 Process button of toolbar doesn't handle access / based on patch from Nicolas Micoud (nmicoud)
This commit is contained in:
parent
dbc3ef550d
commit
5c27c2bf3d
|
@ -170,8 +170,8 @@ public class MInfoWindow extends X_AD_InfoWindow
|
||||||
Iterator<MInfoProcess> iterator = lsInfoProcess.iterator();
|
Iterator<MInfoProcess> iterator = lsInfoProcess.iterator();
|
||||||
while (iterator.hasNext()){
|
while (iterator.hasNext()){
|
||||||
MInfoProcess testInfoProcess = iterator.next();
|
MInfoProcess testInfoProcess = iterator.next();
|
||||||
// need more review
|
Boolean access = MRole.getDefault().getProcessAccess(testInfoProcess.getAD_Process_ID());
|
||||||
if (MRole.getDefault().getProcessAccess(testInfoProcess.getAD_Process_ID()) == null){
|
if (access == null || !access.booleanValue()) {
|
||||||
iterator.remove();
|
iterator.remove();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,8 @@ public class ExecuteProcessCommand extends ServerResource {
|
||||||
String procedureName = (String) entity.get("procedureName");
|
String procedureName = (String) entity.get("procedureName");
|
||||||
|
|
||||||
MRole role = MRole.get(context, Env.getAD_Role_ID(context), Env.getAD_User_ID(context), false);
|
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.");
|
throw new AdempiereException("Access denied.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,6 +62,7 @@ import org.compiere.model.GridWindow;
|
||||||
import org.compiere.model.I_AD_Preference;
|
import org.compiere.model.I_AD_Preference;
|
||||||
import org.compiere.model.MLookup;
|
import org.compiere.model.MLookup;
|
||||||
import org.compiere.model.MPreference;
|
import org.compiere.model.MPreference;
|
||||||
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.model.MTab;
|
import org.compiere.model.MTab;
|
||||||
import org.compiere.model.MTable;
|
import org.compiere.model.MTable;
|
||||||
import org.compiere.model.MToolBarButton;
|
import org.compiere.model.MToolBarButton;
|
||||||
|
@ -632,8 +633,11 @@ DataStatusListener, IADTabpanel, IdSpace, IFieldEditorContainer
|
||||||
//get extra toolbar process buttons
|
//get extra toolbar process buttons
|
||||||
MToolBarButton[] mToolbarButtons = MToolBarButton.getProcessButtonOfTab(gridTab.getAD_Tab_ID(), null);
|
MToolBarButton[] mToolbarButtons = MToolBarButton.getProcessButtonOfTab(gridTab.getAD_Tab_ID(), null);
|
||||||
for(MToolBarButton mToolbarButton : mToolbarButtons) {
|
for(MToolBarButton mToolbarButton : mToolbarButtons) {
|
||||||
ToolbarProcessButton toolbarProcessButton = new ToolbarProcessButton(mToolbarButton, this, windowPanel, windowNo);
|
Boolean access = MRole.getDefault().getProcessAccess(mToolbarButton.getAD_Process_ID());
|
||||||
toolbarProcessButtons.add(toolbarProcessButton);
|
if (access != null && access.booleanValue()) {
|
||||||
|
ToolbarProcessButton toolbarProcessButton = new ToolbarProcessButton(mToolbarButton, this, windowPanel, windowNo);
|
||||||
|
toolbarProcessButtons.add(toolbarProcessButton);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (toolbarProcessButtons.size() > 0) {
|
if (toolbarProcessButtons.size() > 0) {
|
||||||
|
|
Loading…
Reference in New Issue