mcardle 2005/09/06 15:58:38 CEST
Modified files:
core/src/java/org/jahia/aop EsiJspContentDetectionAspect.java
Log:
* adds support for the aclGroup fragment attribute to share fragments between
users with the same group permissions
* now supports containerLists with ID=0
Revision Changes Path
1.5 +30 -10
jahia/core/src/java/org/jahia/aop/EsiJspContentDetectionAspect.java
http://jahia.mine.nu:8080/cgi-bin/cvsweb.cgi/jahia/core/src/java/org/jahia/aop/EsiJspContentDetectionAspect.java.diff?r1=1.4&r2=1.5&f=h
Index: EsiJspContentDetectionAspect.java
===================================================================
RCS file:
/home/cvs/repository/jahia/core/src/java/org/jahia/aop/EsiJspContentDetectionAspect.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- EsiJspContentDetectionAspect.java 30 Aug 2005 15:35:04 -0000 1.4
+++ EsiJspContentDetectionAspect.java 6 Sep 2005 13:58:37 -0000 1.5
@@ -11,6 +11,7 @@
import org.jahia.data.beans.FieldBean;
import org.jahia.data.fields.JahiaField;
import org.jahia.services.pages.JahiaPage;
+import org.jahia.services.acl.JahiaBaseACL;
import org.jahia.data.beans.PageBean;
//import org.codehaus.aspectwerkz.joinpoint.MemberSignature;
@@ -72,7 +73,7 @@
else if (obj instanceof JahiaField)
addContent(joinPoint, (JahiaField)obj, "JahiaField","addField");
else if (verbose) System.err.println(" addField : UNKNOWN
OBJECT TYPE: "+ obj);
- }
+ }
/**
* Aspect which detects access to a Page (usually from JSP pages or
tags)
* and adds its ID to the closest enclosing ESI object (e.g. Fragment
or Template)
@@ -158,31 +159,35 @@
}
String contentType = null;
int objID = -1;
- boolean AddedOK = true;
if (aspObj instanceof PageBean) {
objID = ((PageBean) aspObj).getID();
jesiObj.addPage(objID);
+ jesiObj.addAclUserNames(((PageBean) aspObj).getACL());
contentType = "PageBean";
}
else if (aspObj instanceof JahiaPage) {
objID = ((JahiaPage) aspObj).getID();
jesiObj.addPage(objID );
+ jesiObj.addAclUserNames(((JahiaPage) aspObj).getACL());
contentType = "JahiaPage";
}
else if (aspObj instanceof JahiaField) {
objID = ((JahiaField) aspObj).getID();
jesiObj.addField(objID );
+ jesiObj.addAclUserNames(((JahiaField) aspObj).getACL());
contentType = "JahiaField";
}
else if (aspObj instanceof FieldBean) {
objID =((FieldBean) aspObj).getID();
jesiObj.addField( objID );
+ jesiObj.addAclUserNames(((FieldBean) aspObj).getACL());
contentType = "FieldBean";
}
else if (aspObj instanceof JahiaContainer) {
objID =((JahiaContainer) aspObj).getID();
jesiObj.addContainer(objID);
+ jesiObj.addAclUserNames(((JahiaContainer) aspObj).getACL());
contentType = "JahiaContainer";
int ctnListID = ((JahiaContainer) aspObj).getListID();
addParentContainerList(ctnListID, jesiObj, aspectName,
contentType, objID);
@@ -190,35 +195,50 @@
else if (aspObj instanceof ContainerBean) {
objID =((ContainerBean) aspObj).getID();
jesiObj.addContainer(objID);
+ jesiObj.addAclUserNames(((ContainerBean) aspObj).getACL());
contentType = "ContainerBean";
int ctnListID = ((ContainerBean) aspObj).getContainerListID();
addParentContainerList(ctnListID, jesiObj, aspectName,
contentType, objID);
}
else if (aspObj instanceof JahiaContainerList) {
objID =((JahiaContainerList) aspObj).getID();
- //ignore ctnList 0
- if (objID !=0) {
+ /*TODO: should really ignore uninitialized ctnList with ID=0
since more than one ctnList
+ (of possibly varying definition names) on a page can have the
same ctnList ID=0.
+ In current setup, all fragments referencing ctnList 0 (be it the
same or of different
+ definition names) will be invalidated. This isn't really a
problem because most of fragments
+ with a ctnList=0 will contain little data.
+ Possible workarounds: 1/use the ctnList id=0 AND the ctnList's
definition name as a key so that
+ we don't confound all id=o ctnList on
the page, and only the right fragment
+ would be invalidated
+ 2/rewrite the JahiaContainerSet method so
that it doesn't create temporary
+ id=0 ctnLists in the jData, but a real
contianer with a real ID saved in the
+ database. MC and KN looked into it but
not obvious.
+ 3/get addcontainer Engine to fire an event
which also contains the parent containerList...
+ 4/live with current solution.
+ */
+ //if (objID !=0) {
jesiObj.addContainerList(objID);
+ if (objID !=0) jesiObj.addAclUserNames(((JahiaContainerList)
aspObj).getACL());
contentType = "JahiaContainerList";
int ctnID = ((JahiaContainerList) aspObj).getParentEntryID();
addParentContainer(ctnID, jesiObj, aspectName, contentType,
objID);
- } else AddedOK=false;
+ //}
}
else if (aspObj instanceof ContainerListBean) {
objID =((ContainerListBean) aspObj).getID();
//ignore ctnList 0
- if (objID !=0) {
+ //if (objID !=0) {
jesiObj.addContainerList(objID);
+ if (objID !=0) jesiObj.addAclUserNames(((ContainerListBean)
aspObj).getACL());
contentType = "ContainerListBean";
int ctnID = ((ContainerListBean)
aspObj).getParentContainerID();
addParentContainer(ctnID, jesiObj, aspectName, contentType,
objID);
- } else AddedOK=false;
+ //}
}
else System.err.println(" " + aspectName + ": Not a recognized
object type : " + aspObj);
- if (verbose && AddedOK) System.err.println(" " +
aspectName + ": added " + contentType + " " +
- " ID[" +objID + "]"
- + " to " + jesiObj.getObjDetails());
+ if (verbose) System.err.println(" " + aspectName + ":
added " + contentType + " " +
+ " ID[" +objID + "]" + " to " + jesiObj.getObjDetails());
}