diff --git a/applications/order/groovyScripts/order/OrderViewWebSecure.groovy b/applications/order/groovyScripts/order/OrderViewWebSecure.groovy index fd38170a66..c5bdd5b7ed 100644 --- a/applications/order/groovyScripts/order/OrderViewWebSecure.groovy +++ b/applications/order/groovyScripts/order/OrderViewWebSecure.groovy @@ -21,6 +21,9 @@ import org.apache.ofbiz.order.order.OrderContentWrapper orderHeader = context.orderHeader +// can anybody view an anonymous order? this is set in the screen widget and should only be turned on by an email confirmation screen +allowAnonymousView = context.allowAnonymousView + // if orderHeader is null in OrderView.groovy then it is not null but void here! if (orderHeader) { // set hasPermission, must always exist if the orderHeader != null @@ -44,9 +47,28 @@ if (orderHeader) { hasPermission = true } } + // This is related with OFBIZ-11836 "IDOR vulnerability in the order processing feature" + if (parameters.localDispatcherName.equals("ecommerce")) { + List errMsgList = [] + if (orderHeader.createdBy.equals(person.partyId) + || ("anonymous".equals(orderHeader.createdBy) && "Y".equals(allowAnonymousView))) { + hasPermission = true + canViewInternalDetails = true + } else { + hasPermission = false + canViewInternalDetails = false + errMsgList.add("It's not an error : you are not allowed to view this!") + showErrorMsg = "Y" + } + request.setAttribute("_ERROR_MESSAGE_LIST_", errMsgList) + context.showErrorMsg = showErrorMsg + } + context.hasPermission = hasPermission context.canViewInternalDetails = canViewInternalDetails orderContentWrapper = OrderContentWrapper.makeOrderContentWrapper(orderHeader, request) context.orderContentWrapper = orderContentWrapper + + } diff --git a/applications/order/widget/ordermgr/OrderPrintScreens.xml b/applications/order/widget/ordermgr/OrderPrintScreens.xml index 367eeba7e6..079c8126dd 100644 --- a/applications/order/widget/ordermgr/OrderPrintScreens.xml +++ b/applications/order/widget/ordermgr/OrderPrintScreens.xml @@ -27,55 +27,72 @@ under the License.
- - - - + + + + -