{
UIPortalApplication portalApp = Util.getUIPortalApplication();
UIWorkingWorkspace uiWorkingWS = portalApp.getChildById(UIPortalApplication.UI_WORKING_WS_ID);
UIPageBody pageBody = uiWorkingWS.findFirstComponentOfType(UIPageBody.class);
UIPage uiPage = (UIPage)pageBody.getUIComponent();
UserACL userACL = portalApp.getApplicationComponent(UserACL.class);
if(uiPage != null)
{
return userACL.hasEditPermissionOnPage(uiPage.getOwnerType(), uiPage.getOwnerId(), uiPage.getEditPermission());
}
else
{
UIPortal currentUIPortal = portalApp.<UIWorkingWorkspace>findComponentById(UIPortalApplication.UI_WORKING_WS_ID).findFirstComponentOfType(UIPortal.class);
PageNode currentNode = currentUIPortal.getSelectedNode();
String pageReference = currentNode.getPageReference();
if(pageReference == null)
{
return false;
}
else
{
DataStorage dataStorage = portalApp.getApplicationComponent(DataStorage.class);
Page page = dataStorage.getPage(pageReference);
if(page == null)
{
return false;
}
else
{
return userACL.hasEditPermission(page);
}
}
}
}