Update of /var/cvs/src/org/mmbase/bridge/implementation
In directory james.mmbase.org:/tmp/cvs-serv32261

Modified Files:
        BasicCloud.java 
Log Message:
MMB-1732


See also: http://cvs.mmbase.org/viewcvs/src/org/mmbase/bridge/implementation
See also: http://www.mmbase.org/jira/browse/MMB-1732


Index: BasicCloud.java
===================================================================
RCS file: /var/cvs/src/org/mmbase/bridge/implementation/BasicCloud.java,v
retrieving revision 1.195
retrieving revision 1.196
diff -u -b -r1.195 -r1.196
--- BasicCloud.java     19 Nov 2008 18:04:23 -0000      1.195
+++ BasicCloud.java     25 Nov 2008 13:25:44 -0000      1.196
@@ -29,7 +29,7 @@
  * @author Rob Vermeulen
  * @author Pierre van Rooden
  * @author Michiel Meeuwissen
- * @version $Id: BasicCloud.java,v 1.195 2008/11/19 18:04:23 michiel Exp $
+ * @version $Id: BasicCloud.java,v 1.196 2008/11/25 13:25:44 michiel Exp $
  */
 public class BasicCloud implements Cloud, Cloneable, Comparable<Cloud>, 
SizeMeasurable, Serializable {
 
@@ -537,12 +537,12 @@
         if (name == null) {
             name = "Tran" + uniqueId();
         } else {
-            Transaction oldtransaction = transactions.get(name);
+            BasicTransaction oldtransaction = transactions.get(name);
             if (oldtransaction != null) {
                 if (overwrite) {
                     oldtransaction.cancel();
                 } else {
-                    throw new AlreadyExistsException("Transaction with name " 
+ name + "already exists.");
+                    throw new AlreadyExistsException("Transaction with name " 
+ name + " already exists.");
                 }
             }
         }
@@ -699,6 +699,29 @@
         return resultList;
     }
 
+
+    /**
+     * @since MMBase-1.9.1
+     */
+    boolean setSecurityConstraint(Constraint c) {
+        if (c == null) return true;
+        boolean secure = true;
+        if (c instanceof FieldValueInQueryConstraint) {
+            SearchQuery q = ((FieldValueInQueryConstraint) c).getInQuery();
+            if (q instanceof BasicQuery) {
+                if (! setSecurityConstraint((Query) q)) secure= false;
+            } else {
+                log.warn("Don't know how to set a security constraint on a " + 
q.getClass().getName());
+            }
+        } else if (c instanceof CompositeConstraint) {
+            CompositeConstraint cc = (CompositeConstraint) c;
+            for (Constraint sc : cc.getChilds()) {
+                if (! setSecurityConstraint(sc)) secure = false;
+            }
+        }
+        return secure;
+    }
+
     /**
      * @param query add security constaint to this query
      * @return is query secure
@@ -711,6 +734,10 @@
             if (bquery.isSecure()) { // already set, and secure
                 return true;
             } else {
+
+
+                boolean constraintsSecure = 
setSecurityConstraint(query.getConstraint());
+
                 if (bquery.queryCheck == null) { // not set already, do it now.
                     Authorization.QueryCheck check = auth.check(userContext, 
query, Operation.READ);
                     if (log.isDebugEnabled()) {
@@ -718,7 +745,7 @@
                     }
                     bquery.setSecurityConstraint(check);
                 }
-                return bquery.isSecure();
+                return constraintsSecure && bquery.isSecure();
             }
         } else {
             // should not happen
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs

Reply via email to