This is an automated email from the ASF dual-hosted git repository.
mridulpathak pushed a commit to branch release24.09
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/release24.09 by this push:
new 141c95784b Fixed: Three regressions in the minilang-to-Groovy
conversion of PortalPageServices.groovy (OFBIZ-13611)
141c95784b is described below
commit 141c95784bbc4ce94f0c9d30b9d667d3f30a8ec0
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 60076f4b56..0debc0ded3 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()
}
/**
@@ -135,7 +135,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)
@@ -243,12 +243,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,
@@ -349,13 +349,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()
}