[Bedework-commit] calendarapi r840 - in trunk: calCore/src/org/bedework/calcore calFacade/src/org/bedework/calfacade calFacade/src/org/bedework/calfacade/configs calFacade/src/org/bedework/calfacade/util calsvc/src/org/bedework/calsvc

svnadmin at bedework.org svnadmin at bedework.org
Thu Mar 5 19:26:29 EST 2009


Author: douglm
Date: 2009-03-05 19:26:24 -0500 (Thu, 05 Mar 2009)
New Revision: 840

Modified:
   trunk/calCore/src/org/bedework/calcore/AccessUtil.java
   trunk/calFacade/src/org/bedework/calfacade/BwPrincipal.java
   trunk/calFacade/src/org/bedework/calfacade/DirectoryInfo.java
   trunk/calFacade/src/org/bedework/calfacade/configs/SystemRoots.java
   trunk/calFacade/src/org/bedework/calfacade/util/AbstractDirImpl.java
   trunk/calFacade/src/org/bedework/calfacade/util/AccessUtilI.java
   trunk/calsvc/src/org/bedework/calsvc/CalSvc.java
Log:
Fix up acl evaluation to handle principals correctly.

Change to the restore process to make bedework admin group principals 

Modified: trunk/calCore/src/org/bedework/calcore/AccessUtil.java
===================================================================
--- trunk/calCore/src/org/bedework/calcore/AccessUtil.java	2009-03-05 02:45:38 UTC (rev 839)
+++ trunk/calCore/src/org/bedework/calcore/AccessUtil.java	2009-03-06 00:26:24 UTC (rev 840)
@@ -396,13 +396,13 @@
         }
 
         if (desiredAccess == privAny) {
-          ca = access.checkAny(authUser, owner, aclChars, maxPrivs);
+          ca = access.checkAny(cb, authUser, owner, aclChars, maxPrivs);
         } else if (desiredAccess == privRead) {
-          ca = access.checkRead(authUser, owner, aclChars, maxPrivs);
+          ca = access.checkRead(cb, authUser, owner, aclChars, maxPrivs);
         } else if (desiredAccess == privWrite) {
-          ca = access.checkReadWrite(authUser, owner, aclChars, maxPrivs);
+          ca = access.checkReadWrite(cb, authUser, owner, aclChars, maxPrivs);
         } else {
-          ca = access.evaluateAccess(authUser, owner, desiredAccess, aclChars,
+          ca = access.evaluateAccess(cb, authUser, owner, desiredAccess, aclChars,
                                      maxPrivs);
         }
       }

Modified: trunk/calFacade/src/org/bedework/calfacade/BwPrincipal.java
===================================================================
--- trunk/calFacade/src/org/bedework/calfacade/BwPrincipal.java	2009-03-05 02:45:38 UTC (rev 839)
+++ trunk/calFacade/src/org/bedework/calfacade/BwPrincipal.java	2009-03-06 00:26:24 UTC (rev 840)
@@ -372,28 +372,22 @@
     getGroups().add(val);
   }
 
-  /** Set of groupNames of which principal is a member. These are not just those
-   * of which the principal is a direct member but also those it is a member of
-   * by virtue of membership of other groups. For example <br/>
-   * If the principal is a member of groupA and groupA is a member of groupB
-   * the groupB should appear in the list.
-   *
-   * @param val        Set of String
+  /* (non-Javadoc)
+   * @see edu.rpi.cmt.access.AccessPrincipal#setGroupNames(java.util.Collection)
    */
   public void setGroupNames(Collection<String> val) {
     groupNames = val;
   }
 
-  /** Get the group names of which principal is a member.
-   *
-   * @return Set    of String
+  /* (non-Javadoc)
+   * @see edu.rpi.cmt.access.AccessPrincipal#getGroupNames()
    */
   @NoDump
   public Collection<String> getGroupNames() {
     if (groupNames == null) {
       groupNames = new TreeSet<String>();
       for (BwGroup group: getGroups()) {
-        groupNames.add(group.getAccount());
+        groupNames.add(group.getPrincipalRef());
       }
     }
     return groupNames;

Modified: trunk/calFacade/src/org/bedework/calfacade/DirectoryInfo.java
===================================================================
--- trunk/calFacade/src/org/bedework/calfacade/DirectoryInfo.java	2009-03-05 02:45:38 UTC (rev 839)
+++ trunk/calFacade/src/org/bedework/calfacade/DirectoryInfo.java	2009-03-06 00:26:24 UTC (rev 840)
@@ -35,6 +35,7 @@
   private String principalRoot;
   private String userPrincipalRoot;
   private String groupPrincipalRoot;
+  private String bwadmingroupPrincipalRoot;
   private String resourcePrincipalRoot;
   private String venuePrincipalRoot;
   private String ticketPrincipalRoot;
@@ -88,6 +89,22 @@
     return groupPrincipalRoot;
   }
 
+  /** Set the bedework admin group principal root e.g. "/principals/groups/bwadmin"
+   *
+   * @param val    String
+   */
+  public void setBwadmingroupPrincipalRoot(String val) {
+    bwadmingroupPrincipalRoot = val;
+  }
+
+  /** get the bedework admin group principal root e.g. "/principals/groups/bwadmin"
+   *
+   * @return String
+   */
+  public String getBwadmingroupPrincipalRoot() {
+    return bwadmingroupPrincipalRoot;
+  }
+
   /** Set the resource principal root e.g. "/principals/resources"
    *
    * @param val    String

Modified: trunk/calFacade/src/org/bedework/calfacade/configs/SystemRoots.java
===================================================================
--- trunk/calFacade/src/org/bedework/calfacade/configs/SystemRoots.java	2009-03-05 02:45:38 UTC (rev 839)
+++ trunk/calFacade/src/org/bedework/calfacade/configs/SystemRoots.java	2009-03-06 00:26:24 UTC (rev 840)
@@ -37,6 +37,7 @@
   private String principalRoot;
   private String userPrincipalRoot;
   private String groupPrincipalRoot;
+  private String bwadmingroupPrincipalRoot;
   private String resourcePrincipalRoot;
   private String venuePrincipalRoot;
   private String ticketPrincipalRoot;
@@ -90,6 +91,24 @@
     return groupPrincipalRoot;
   }
 
+  /** Set the bedework admin group principal root
+   * e.g. "/principals/groups/bwadmin"
+   *
+   * @param val    String
+   */
+  public void setBwadmingroupPrincipalRoot(String val) {
+    bwadmingroupPrincipalRoot = val;
+  }
+
+  /** Get the bedework admin group principal root
+   * e.g. "/principals/groups/bwadmin"
+   *
+   * @return String
+   */
+  public String getBwadmingroupPrincipalRoot() {
+    return bwadmingroupPrincipalRoot;
+  }
+
   /** Set the resource principal root e.g. "/principals/resources"
    *
    * @param val    String

Modified: trunk/calFacade/src/org/bedework/calfacade/util/AbstractDirImpl.java
===================================================================
--- trunk/calFacade/src/org/bedework/calfacade/util/AbstractDirImpl.java	2009-03-05 02:45:38 UTC (rev 839)
+++ trunk/calFacade/src/org/bedework/calfacade/util/AbstractDirImpl.java	2009-03-06 00:26:24 UTC (rev 840)
@@ -150,6 +150,7 @@
     info.setPrincipalRoot(sr.getPrincipalRoot());
     info.setUserPrincipalRoot(sr.getUserPrincipalRoot());
     info.setGroupPrincipalRoot(sr.getGroupPrincipalRoot());
+    info.setBwadmingroupPrincipalRoot(sr.getBwadmingroupPrincipalRoot());
     info.setTicketPrincipalRoot(sr.getTicketPrincipalRoot());
     info.setResourcePrincipalRoot(sr.getResourcePrincipalRoot());
     info.setVenuePrincipalRoot(sr.getVenuePrincipalRoot());

Modified: trunk/calFacade/src/org/bedework/calfacade/util/AccessUtilI.java
===================================================================
--- trunk/calFacade/src/org/bedework/calfacade/util/AccessUtilI.java	2009-03-05 02:45:38 UTC (rev 839)
+++ trunk/calFacade/src/org/bedework/calfacade/util/AccessUtilI.java	2009-03-06 00:26:24 UTC (rev 840)
@@ -29,6 +29,7 @@
 import edu.rpi.cmt.access.Ace;
 import edu.rpi.cmt.access.AceWho;
 import edu.rpi.cmt.access.PrivilegeDefs;
+import edu.rpi.cmt.access.Access.AccessCb;
 import edu.rpi.cmt.access.Acl.CurrentAccess;
 
 import org.bedework.calfacade.base.BwShareableContainedDbentity;
@@ -57,7 +58,7 @@
   /** Methods called to obtain system information.
    *
    */
-  public static abstract class CallBack implements Serializable {
+  public static abstract class CallBack implements AccessCb, Serializable {
     /**
      * @param href
      * @return AccessPrincipal or null for not valid

Modified: trunk/calsvc/src/org/bedework/calsvc/CalSvc.java
===================================================================
--- trunk/calsvc/src/org/bedework/calsvc/CalSvc.java	2009-03-05 02:45:38 UTC (rev 839)
+++ trunk/calsvc/src/org/bedework/calsvc/CalSvc.java	2009-03-06 00:26:24 UTC (rev 840)
@@ -106,6 +106,7 @@
 import org.bedework.sysevents.events.SysEvent;
 
 import edu.rpi.cmt.access.Access;
+import edu.rpi.cmt.access.AccessException;
 import edu.rpi.cmt.access.AccessPrincipal;
 import edu.rpi.cmt.access.Ace;
 import edu.rpi.cmt.access.AceWho;
@@ -232,6 +233,18 @@
     public String getUserCalendarRoot() throws CalFacadeException {
       return getSysparsHandler().get().getUserCalendarRoot();
     }
+
+    /* (non-Javadoc)
+     * @see edu.rpi.cmt.access.Access.AccessCb#makeHref(java.lang.String, int)
+     */
+    public String makeHref(String id, int whoType) throws AccessException {
+      try {
+        return svci.getDirectories().makePrincipalUri(id, whoType);
+      } catch (Throwable t) {
+        throw new AccessException(t);
+      }
+    }
+
   }
 
   /** Class used by UseAuth to do calls into CalSvci



More information about the Bedework-commit mailing list