This is an automated email from the ASF dual-hosted git repository.

mridulpathak pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/trunk by this push:
     new b39268e8a8 Fixed: Three regressions in the minilang-to-Groovy 
conversion of PortalPageServices.groovy (OFBIZ-13611)
b39268e8a8 is described below

commit b39268e8a803d66d5539b8788c6e1f3aa7098003
Author: Mridul Pathak <[email protected]>
AuthorDate: Sat Sep 26 17:31:58 2026 +0530

    Fixed: Three regressions in the minilang-to-Groovy conversion of 
PortalPageServices.groovy (OFBIZ-13611)
    
    updatePortletSeqDragDrop() now sets parameters.portalPageId from 
o_portalPageId before calling checkOwnerShip() instead of after, so the 
ownership/MYPORTALBASE_ADMIN check actually runs against the real page instead 
of silently no-opping on every call.
    
    getPortletAttributes() no longer throws when the given ownerUserLoginId has 
never customized the requested portlet, matching the original mini-lang's 
graceful empty-result behavior on that path.
    
    movePortletToPortalPage() no longer returns the just-removed source 
portlet's stale fields in its response.
    
    Also fixes two adjacent bugs in checkOwnerShip() itself, found while 
verifying the ownership-check reordering above (its error paths had never 
actually been exercised before): both error() calls passed their 
GenericValue/Map context directly instead of wrapping it under the key their 
label templates expect (${portalPage.portalPageName}, 
${parameters.portalPageId}), which crashed outright for the owner-mismatch case 
since GenericEntity.get() throws for unrecognized field names.
---
 .../groovy/org/apache/ofbiz/common/PortalPageServices.groovy | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git 
a/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
 
b/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
index 626f2b37cf..c46e7c6e4d 100644
--- 
a/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
+++ 
b/framework/common/src/main/groovy/org/apache/ofbiz/common/PortalPageServices.groovy
@@ -45,7 +45,7 @@ Map movePortletToPortalPage() {
         targetPortalPortlet.create()
         sourcePortalPagePortlet.remove()
     }
-    return success(sourcePortalPagePortlet)
+    return success()
 }
 
 /**
@@ -134,7 +134,7 @@ Map getPortletAttributes() {
                 .where(ownerUserLoginId: parameters.ownerUserLoginId,
                         portalPortletId: parameters.portalPortletId)
                 .queryFirst()
-        parameters.portalPageId = portalPagePortlet.portalPageId
+        parameters.portalPageId = portalPagePortlet?.portalPageId
     }
     EntityCondition condition = new EntityConditionBuilder().AND {
         EQUALS(portalPageId: parameters.portalPageId)
@@ -242,12 +242,12 @@ Map updatePortalPageSeq() {
  * @return Success response after move
  */
 Map updatePortletSeqDragDrop() {
+    // update Portlet Seq with Drag & Drop
+    parameters.portalPageId = parameters.o_portalPageId
     Map checkIsOwner = checkOwnerShip()
     if (ServiceUtil.isError(checkIsOwner)) {
         return checkIsOwner
     }
-    // update Portlet Seq with Drag & Drop
-    parameters.portalPageId = parameters.o_portalPageId
     GenericValue originPp = from('PortalPagePortlet')
             .where(portalPageId: parameters.o_portalPageId,
                     portalPortletId: parameters.o_portalPortletId,
@@ -346,13 +346,13 @@ private Map checkOwnerShip() {
     }
     GenericValue portalPage = 
from('PortalPage').where(parameters).cache().queryOne()
     if (!portalPage) {
-        return error(label('CommonUiLabels', 'PortalPageNotFound', parameters))
+        return error(label('CommonUiLabels', 'PortalPageNotFound', 
[parameters: parameters]))
     }
 
     // only page owner or user with MYPORTALBASE_ADMIN can modify the page 
detail
     if (portalPage.ownerUserLoginId != userLogin.userLoginId &&
             !security.hasPermission('MYPORTALBASE_ADMIN', userLogin)) {
-        return error(label('CommonUiLabels', 'PortalPageNotOwned', portalPage))
+        return error(label('CommonUiLabels', 'PortalPageNotOwned', 
[portalPage: portalPage]))
     }
     return success()
 }

Reply via email to