From 5a5b9a2042ab49628954934d91f0260538556a6c Mon Sep 17 00:00:00 2001 From: pb Date: Fri, 15 Feb 2008 00:12:38 +0000 Subject: [PATCH] incorporating: r1621 | chrisg23 | 2007-09-13 14:43:12 +0200 (Do, 13 Sep 2007) | 1 line Sourceforge patch 1707913 - final part of performance improvement changes. Prevent excessively setting content section as the context of contentitems, and don't give text assets a security context (they don't need one as they are never accesed outside their owner) git-svn-id: https://svn.libreccm.org/ccm/trunk@6 8810af33-2d31-482b-a856-94f89814c4df --- ccm-cms/src/com/arsdigita/cms/ContentItem.java | 17 ++++++++++------- .../cms/ui/authoring/TextPageBody.java | 9 +++++++-- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/ccm-cms/src/com/arsdigita/cms/ContentItem.java b/ccm-cms/src/com/arsdigita/cms/ContentItem.java index 875b808ef..626b5d1cd 100755 --- a/ccm-cms/src/com/arsdigita/cms/ContentItem.java +++ b/ccm-cms/src/com/arsdigita/cms/ContentItem.java @@ -322,10 +322,7 @@ public class ContentItem extends VersionedACSObject implements CustomCopy { if (PARENT.equals(name)) { ContentItem ci = (ContentItem) dobj; - if (newVal == null) { - PermissionService.setContext - (ci, ci.getContentSection()); - } else { + if (newVal != null) { PermissionService.setContext (ci.getOID(), ((DataObject) newVal).getOID()); } @@ -429,22 +426,28 @@ public class ContentItem extends VersionedACSObject implements CustomCopy { } } + /* + + removed cg - object observer sets context based + on parent whenever parent is updated + protected void afterSave() { super.afterSave(); - + s_log.info("******After Save of object " + getOID()); // Set the object's context to its parent object for // permissioning. if (m_wasNew) { final ACSObject parent = getParent(); - if (parent == null) { + s_log.info("parent is null - set context to content section"); PermissionService.setContext(this, getContentSection()); } else { + s_log.info("parent is " + parent.getOID()); PermissionService.setContext(this, parent); } } } - + */ private void setDefaultContentSection() { s_log.debug("Setting the default content section"); diff --git a/ccm-cms/src/com/arsdigita/cms/ui/authoring/TextPageBody.java b/ccm-cms/src/com/arsdigita/cms/ui/authoring/TextPageBody.java index ca584c5dc..c2a646caa 100755 --- a/ccm-cms/src/com/arsdigita/cms/ui/authoring/TextPageBody.java +++ b/ccm-cms/src/com/arsdigita/cms/ui/authoring/TextPageBody.java @@ -104,7 +104,9 @@ public class TextPageBody extends TextAssetBody { TextPage item = getTextPage(s); TextAsset t = new TextAsset(); t.setName(item.getName() + "_text_" + item.getID()); - t.setParent(item); + // no need - cg. Text doesn't need a security context, + // and ownership of text is recorded in text_pages + // t.setParent(item); return t; } @@ -118,7 +120,10 @@ public class TextPageBody extends TextAssetBody { protected void updateTextAsset(PageState s, TextAsset a) { TextPage t = getTextPage(s); Assert.assertNotNull(t); - a.setParent(t); + // no need - cg. Text doesn't need a security context, + // and ownership of text is recorded in text_pages + + // a.setParent(t); t.setTextAsset(a); a.save(); t.save();