Changeset 331

Show
Ignore:
Timestamp:
04/05/06 10:16:45
Author:
douglm
Message:

1. Fix group selection at admin startup

2. Rollback on certain exceptional conditions.

3. More changes to make access information available to apps.
Removed getAcl from svci and calintf. The information is now available in the EventInfo? object and
in cloned calendar objects.

Note: this is still not fully functional. Access information is only partially available.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Ace.java

    r314 r331  
    343343  } 
    344344 
     345  /** Return an ace which matches the name and whoType. 
     346   * 
     347   * @param acl 
     348   * @param name 
     349   * @param whoType 
     350   * @return Ace   if we find a match else null 
     351   * @throws AccessException 
     352   */ 
     353  public static Ace find(Acl acl, 
     354                         String name, int whoType) throws AccessException { 
     355    Iterator it = acl.getAces().iterator(); 
     356     
     357    while (it.hasNext()) { 
     358      Ace ace = (Ace)it.next(); 
     359 
     360      if ((whoType == ace.getWhoType()) && 
     361          ((whoType == whoTypeUnauthenticated) || 
     362           (whoType == whoTypeOwner) ||  
     363            ace.whoMatch(name))) { 
     364        return ace; 
     365      } 
     366    } 
     367 
     368    return null; 
     369  } 
     370   
    345371  /* ==================================================================== 
    346372   *                 Decoding methods 
     
    368394   * group but what's the inverted meaning? 
    369395   * 
    370    * <p>If .getPrivileges is true the Collection of privilege objects 
     396   * <p>If getPrivileges is true the Collection of privilege objects 
    371397   * defining the ace will be returned. This is needed for acl 
    372398   * manipulation rather than evaluation. 
  • trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Acl.java

    r320 r331  
    8888 
    8989  /** Used while evaluating access */ 
    90   private Ace ace = new Ace(); 
     90//  private Ace ace = new Ace(); 
    9191 
    9292  /** Constructor 
     
    123123   */ 
    124124  public static class CurrentAccess { 
     125    /** The Acl used to evaluate the access. We should not necessarily  
     126     * make this available to the client. 
     127     */ 
     128    public Acl acl; 
     129     
    125130    /**  Allowed access for each privilege type  
    126131     * @see PrivilegeDefs 
     
    177182    CurrentAccess ca = new CurrentAccess(); 
    178183    ca.desiredAccess = how; 
    179  
     184    ca.acl = this; 
     185 
     186    /* 
    180187    setEncoded(acl); 
    181188 
     
    259266      } 
    260267    } // getPrivileges 
     268    */ 
     269    decode(acl); 
     270 
     271    if (authenticated) { 
     272      isOwner = who.getAccount().equals(owner); 
     273    } 
     274 
     275    StringBuffer debugsb = null; 
     276 
     277    if (debug) { 
     278      debugsb = new StringBuffer("Check access for '"); 
     279      debugsb.append(new String(acl)); 
     280      debugsb.append("' with authenticated = "); 
     281      debugsb.append(authenticated); 
     282      debugsb.append(" isOwner = "); 
     283      debugsb.append(isOwner); 
     284    } 
     285 
     286    Ace ace; 
     287     
     288    getPrivileges: { 
     289      if (!authenticated) { 
     290        ace = Ace.find(this, null, Ace.whoTypeUnauthenticated); 
     291        if (ace != null) { 
     292          ca.privileges = ace.getHow(); 
     293        } 
     294 
     295        break getPrivileges; 
     296      } 
     297 
     298      if (isOwner) { 
     299        ace = Ace.find(this, null, Ace.whoTypeOwner); 
     300        if (ace != null) { 
     301          ca.privileges = ace.getHow(); 
     302        } else { 
     303          ca.privileges = defaultOwnerPrivileges; 
     304        } 
     305 
     306        break getPrivileges; 
     307      } 
     308 
     309      // Not owner - look for user 
     310      ace = Ace.find(this, who.getAccount(), Ace.whoTypeUser); 
     311      if (ace != null) { 
     312        ca.privileges = ace.getHow(); 
     313        if (debug) { 
     314          debugsb.append("... For user got: " + new String(ca.privileges)); 
     315        } 
     316 
     317        break getPrivileges; 
     318      } 
     319 
     320      // No specific user access - look for group access 
     321 
     322      if (who.getGroupNames() != null) { 
     323        Iterator it = who.getGroupNames().iterator(); 
     324 
     325        while (it.hasNext()) { 
     326          String group = (String)it.next(); 
     327          if (debug) { 
     328            debugsb.append("...Try access for group " + group); 
     329          } 
     330          ace = Ace.find(this, group, Ace.whoTypeGroup); 
     331          if (ace != null) { 
     332            ca.privileges = mergePrivileges(ca.privileges, ace.getHow()); 
     333          } 
     334        } 
     335      } 
     336 
     337      if (ca.privileges != null) { 
     338        if (debug) { 
     339          debugsb.append("...For groups got: " + new String(ca.privileges)); 
     340        } 
     341 
     342        break getPrivileges; 
     343      } 
     344 
     345      // "other" access set? 
     346      ace = Ace.find(this, null, Ace.whoTypeOther); 
     347      if (ace != null) { 
     348        ca.privileges = ace.getHow(); 
     349 
     350        if (debug) { 
     351          debugsb.append("...For other got: " + new String(ca.privileges)); 
     352        } 
     353 
     354        break getPrivileges; 
     355      } 
     356    } // getPrivileges 
    261357 
    262358    if (ca.privileges == null) { 
  • trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Privilege.java

    r314 r331  
    105105  } 
    106106 
     107  /** Constructor for non-abstract non-denial 
     108   * 
     109   * @param name 
     110   * @param description 
     111   * @param index 
     112   */ 
     113  public Privilege(String name, 
     114                   String description, 
     115                   int index) { 
     116    this(name, description, false, false, index); 
     117  } 
     118 
    107119  /** 
    108120   * @param val 
  • trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Privileges.java

    r314 r331  
    104104   
    105105  static { 
    106     privs[privAll] = new Privilege("all", "All privileges", false, false, 
    107                                    privAll); 
    108  
    109     privs[privRead] = new Privilege("read", "Read any calendar object", false, false, 
    110                                     privRead); 
    111      
    112     privs[privReadAcl] = new Privilege("read-acl", "Read calendar accls", false, false, 
     106    privs[privAll] = new Privilege("all", "All privileges", privAll); 
     107 
     108    privs[privRead] = new Privilege("read", "Read any calendar object", privRead); 
     109     
     110    privs[privReadAcl] = new Privilege("read-acl", "Read calendar accls",  
    113111                                       privReadAcl); 
    114112     
    115113    privs[privReadCurrentUserPrivilegeSet] = 
    116114      new Privilege("read-current-user-privilege-set", 
    117                     "Read current user privilege set property", false, false, 
     115                    "Read current user privilege set property",  
    118116                    privReadCurrentUserPrivilegeSet); 
    119117     
    120118    privs[privReadFreeBusy] = new Privilege("view-free-busy",  
    121119                                            "View a users free busy information",  
    122                                             false, false, privReadFreeBusy); 
    123      
    124     privs[privWrite] = new Privilege("write", "Write any calendar object", false, false, 
     120                                            privReadFreeBusy); 
     121     
     122    privs[privWrite] = new Privilege("write", "Write any calendar object",  
    125123                                     privWrite); 
    126124     
    127     privs[privWriteAcl] = new Privilege("write-acl", "Write ACL", false, false, 
    128                                         privWriteAcl); 
    129      
    130     privs[privWriteProperties] = new Privilege("write-properties", "Write calendar properties", false, false, 
     125    privs[privWriteAcl] = new Privilege("write-acl", "Write ACL", privWriteAcl); 
     126     
     127    privs[privWriteProperties] = new Privilege("write-properties",  
     128                                               "Write calendar properties",  
    131129                                               privWriteProperties); 
    132130     
    133     privs[privWriteContent] = new Privilege("write-content", "Write calendar content", false, false, 
     131    privs[privWriteContent] = new Privilege("write-content",  
     132                                            "Write calendar content",  
    134133                                            privWriteContent); 
    135134     
    136     privs[privBind] = new Privilege("create", "Create a calendar object", false, false, 
     135    privs[privBind] = new Privilege("create", "Create a calendar object",  
    137136                                    privBind); 
    138137     
    139     privs[privUnbind] = new Privilege("delete", "Delete a calendar object", false, false, 
     138    privs[privUnbind] = new Privilege("delete", "Delete a calendar object",  
    140139                                      privUnbind); 
    141140     
    142     privs[privUnlock] = new Privilege("unlock", "Remove a lock", false, false, 
     141    privs[privUnlock] = new Privilege("unlock", "Remove a lock",  
    143142                                      privUnlock); 
    144143     
  • trunk/calendar3/appcommon/src/org/bedework/appcommon/AccessAppUtil.java

    r320 r331  
    168168          Ace ace = (Ace)it.next(); 
    169169 
    170           emitAce(ace, true); 
    171           emitAce(ace, false); 
     170          boolean aceOpen = emitAce(ace, true, false); 
     171          if (emitAce(ace, false, aceOpen)) { 
     172            aceOpen = true; 
     173          } 
     174 
     175          if (aceOpen) { 
     176            xml.closeTag(WebdavTags.ace); 
     177          } 
    172178        } 
    173179      } 
     
    180186    } 
    181187  } 
    182    
     188 
    183189  /** Produce an xml representation of supported privileges. This is the same 
    184190   * at all points in the system and is identical to the webdav/caldav  
     
    279285  } 
    280286   
    281   private void emitAce(Ace ace, boolean denials) throws Throwable { 
     287  private boolean emitAce(Ace ace, boolean denials, boolean aceOpen) throws Throwable { 
    282288    Collection privs = ace.getPrivs(); 
    283     boolean emittedWho = false; 
     289    boolean tagOpen = false; 
    284290 
    285291    QName tag; 
     
    295301 
    296302      if (denials == p.getDenial()) { 
    297         if (!emittedWho) { 
     303        if (!aceOpen) { 
     304          xml.openTag(WebdavTags.ace); 
     305 
    298306          emitAceWho(ace); 
    299           emittedWho = true; 
     307          aceOpen = true; 
    300308        } 
    301309 
    302         xml.openTag(tag); 
     310        if (!tagOpen) { 
     311          xml.openTag(tag); 
     312          tagOpen = true; 
     313        } 
    303314        xml.emptyTag(privTags[p.getIndex()]); 
    304         xml.closeTag(tag); 
    305315      } 
    306316    } 
    307  
    308     if (emittedWho) { 
    309       xml.closeTag(WebdavTags.ace); 
    310     } 
     317     
     318    if (tagOpen) { 
     319      xml.closeTag(tag); 
     320    } 
     321     
     322    return aceOpen; 
    311323  } 
    312324 
    313325  private void emitAceWho(Ace ace) throws Throwable { 
    314     xml.openTag(WebdavTags.ace); 
    315  
    316326    boolean invert = ace.getNotWho(); 
    317327 
  • trunk/calendar3/appcommon/src/org/bedework/appcommon/EventFormatter.java

    r320 r331  
    210210    try { 
    211211      if (xmlAccess == null) { 
    212         Acl acl = svci.getAcl(getEvent()); 
     212//        Acl acl = svci.getAcl(getEvent()); 
     213        Acl acl = eventInfo.getCurrentAccess().acl; 
    213214        xmlAccess = AccessAppUtil.getXmlAclString(acl); 
    214215      } 
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/AccessUtil.java

    r320 r331  
    171171                           Collection aces) throws CalFacadeException { 
    172172    try { 
    173       Acl acl = getAces(ent, privWriteAcl)
     173      Acl acl = checkAccess(ent, privWriteAcl, false).acl
    174174 
    175175      Iterator it = aces.iterator(); 
     
    182182 
    183183      ent.setAccess(new String(acl.encode())); 
    184     } catch (Throwable t) { 
    185       throw new CalFacadeException(t); 
    186     } 
    187   } 
    188  
    189   /** Return the acl representing the allowed access for the given object. This 
    190    * may be derived from an object higher up the tree. 
    191    * 
    192    * @param ent 
    193    * @return Acl 
    194    * @throws CalFacadeException 
    195    */ 
    196   public Acl getAcl(BwShareableDbentity ent) throws CalFacadeException { 
    197     try { 
    198       return getAces(ent, privReadAcl); 
    199     } catch (CalFacadeAccessException cae) { 
    200       Acl acl = new Acl(); 
    201       acl.defaultAccess(); 
    202        
    203       return acl; 
    204184    } catch (Throwable t) { 
    205185      throw new CalFacadeException(t); 
     
    224204    while (it.hasNext()) { 
    225205      BwShareableDbentity sdbe = (BwShareableDbentity)it.next(); 
    226       if (accessible(sdbe, desiredAccess, nullForNoAccess)) { 
     206      if (checkAccess(sdbe, desiredAccess, nullForNoAccess).accessAllowed) { 
    227207        out.add(sdbe); 
    228208      } 
     
    232212  } 
    233213 
    234   /* Check access for the given entity. Returns the character representation of 
    235    * the ace array. 
    236    */ 
    237   boolean accessible(BwShareableDbentity ent, int desiredAccess, 
    238                     boolean nullForNoAccess) throws CalFacadeException { 
    239     return checkAccess(ent, desiredAccess, nullForNoAccess).accessAllowed; 
    240   } 
    241  
    242214  /* Check access for the given entity. Returns the current access 
    243215   */ 
    244216  CurrentAccess checkAccess(BwShareableDbentity ent, int desiredAccess, 
    245                       boolean nullForNoAccess) throws CalFacadeException { 
     217                      boolean returnResult) throws CalFacadeException { 
    246218    if (ent == null) { 
    247       return new CurrentAccess(); 
    248     } 
    249  
    250     if ((authUser != null) && superUser) { 
    251       // Nobody can stop us - BWAAA HAA HAA 
    252       CurrentAccess ca = new CurrentAccess(); 
    253       ca.accessAllowed = true; 
    254        
    255       return ca; 
     219      return null; 
    256220    } 
    257221 
     
    263227    } 
    264228 
    265     char[] aclChars = getAclChars((BwShareableDbentity)ent); 
    266  
    267     return checkAccess(aclChars, ent.getOwner(), desiredAccess, 
    268                     nullForNoAccess); 
    269   } 
    270  
    271   /** This does access checking for shareable objects and returns the merged 
    272    * list of ace objects. 
    273    * 
    274    * @param ent          BwShareableDbentity object 
    275    * @param desiredAccess int access we want 
    276    * @return Collection of merged Ace or null for no access 
    277    * @throws CalFacadeException 
    278    */ 
    279   Acl getAces(BwShareableDbentity ent, int desiredAccess) 
    280           throws CalFacadeException { 
    281     if (ent == null) { 
    282       return null; 
    283     } 
    284  
    285     if (debug) { 
    286       String cname = ent.getClass().getName(); 
    287       getLog().debug("Check access for object " + 
    288                      cname.substring(cname.lastIndexOf(".") + 1) + 
    289                      " with id " + ent.getId()); 
    290     } 
    291  
    292     char[] aclChars = getAclChars((BwShareableContainedDbentity)ent); 
    293  
    294     if ((authUser == null) || !superUser) { 
    295       // Need to check access 
    296       checkAccess(aclChars, ent.getOwner(), desiredAccess, false); 
    297     } 
    298  
    299     try { 
    300       Acl acl = new Acl(); 
    301       acl.decode(aclChars); 
    302  
    303       return acl; 
    304     } catch (Throwable t) { 
    305       throw new CalFacadeException(t); 
    306     } 
    307   } 
    308  
    309   /* This does access checking given an acl string and owner. 
    310    * 
    311    * XXX Should we save the result of previous checks for a given 
    312    *      acl string + principal + owner + desiredAccess? 
    313    * 
    314    * @param aclChars    char[] defining current acls for object 
    315    * @param owner       BwUser owner of the object 
    316    * @param desiredAccess int access we want 
    317    * @param returnResult  if true we return false for no access else throw 
    318    *                    an exception 
    319    * @return CurrentAccess   access + allowed/disallowed 
    320    */ 
    321   private CurrentAccess checkAccess(char[] aclChars, BwUser owner, int desiredAccess, 
    322                               boolean returnResult) throws CalFacadeException { 
    323  
    324229    try { 
    325230      CurrentAccess ca; 
     231      String account = ent.getOwner().getAccount(); 
     232       
     233      char[] aclChars = getAclChars(ent); 
     234 
    326235      if (desiredAccess == privRead) { 
    327         ca = access.checkRead(authUser, owner.getAccount(), 
    328                               aclChars); 
     236        ca = access.checkRead(authUser, account, aclChars); 
    329237      } else if (desiredAccess == privWrite) { 
    330         ca = access.checkReadWrite(authUser, owner.getAccount(), 
    331                                    aclChars); 
     238        ca = access.checkReadWrite(authUser, account, aclChars); 
    332239      } else { 
    333         /* Do it the awkward way */ 
    334         ca = access.evaluateAccess(authUser, owner.getAccount(), 
    335                                    desiredAccess, aclChars); 
    336       } 
    337  
     240        ca = access.evaluateAccess(authUser, account, desiredAccess, aclChars); 
     241      } 
     242 
     243      if ((authUser != null) && superUser) { 
     244        // Nobody can stop us - BWAAA HAA HAA 
     245        ca.accessAllowed = true;  
     246      } 
     247       
    338248      if (!ca.accessAllowed && !returnResult) { 
    339249        throw new CalFacadeAccessException(); 
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Calendars.java

    r320 r331  
    6464import java.util.Collection; 
    6565import java.util.Iterator; 
     66import java.util.TreeSet; 
    6667 
    6768/** Class to encapsulate most of what we do with calendars 
     
    204205    sess.cacheableQuery(); 
    205206 
    206     return access.checkAccess(sess.getList(), privWrite, true); 
     207    return postGet(sess.getList(), privWrite); 
    207208  } 
    208209 
     
    226227    sess.cacheableQuery(); 
    227228 
    228     return access.checkAccess(sess.getList(), privWrite, noAccessReturnsNull); 
     229    return postGet(sess.getList(), privWrite); 
    229230  } 
    230231 
     
    260261 
    261262    if (cal != null) { 
    262       access.accessible(cal, privRead, false); 
     263      // Need to clone for this 
     264      //cal.setCurrentAccess(access.checkAccess(cal, privRead, false)); 
     265      access.checkAccess(cal, privRead, false); 
    263266    } 
    264267 
     
    276279 
    277280    if (cal != null) { 
    278       access.accessible(cal, privRead, false); 
     281      // Need to clone for this 
     282      //cal.setCurrentAccess(access.checkAccess(cal, privRead, false)); 
     283      access.checkAccess(cal, privRead, false); 
    279284    } 
    280285 
     
    312317 
    313318    /* We need write access to the parent */ 
    314     access.accessible(parent, privWrite, false); 
     319    access.checkAccess(parent, privWrite, false); 
    315320 
    316321    /** Is the parent a calendar collection? 
     
    411416   * ==================================================================== */ 
    412417 
     418  /* Return a Collection of the calendars after checking access 
     419   * 
     420   */ 
     421  private Collection postGet(Collection cals, int desiredAccess) 
     422             throws CalFacadeException { 
     423    TreeSet out = new TreeSet(); 
     424 
     425    Iterator it = cals.iterator(); 
     426 
     427    while (it.hasNext()) { 
     428      BwCalendar cal = (BwCalendar)it.next(); 
     429      CurrentAccess ca = access.checkAccess(cal, desiredAccess,  
     430                                            noAccessReturnsNull); 
     431      if (ca != null) { 
     432        //cal.setCurrentAccess(ca); 
     433        out.add(cal); 
     434      } 
     435    } 
     436 
     437    return out; 
     438  } 
     439 
    413440  /* Returns the cloned (sub)tree of calendars to which user has access 
    414441   * 
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java

    r321 r331  
    5454package org.bedework.calcore.hibernate; 
    5555 
    56 import edu.rpi.cct.uwcal.access.Acl; 
    5756import edu.rpi.cct.uwcal.access.PrivilegeDefs; 
    5857 
     
    497496    try { 
    498497      if (sess != null) { 
     498        if (sess.transactionStarted()) { 
     499          sess.rollback(); 
     500        } 
    499501        sess.disconnect(); 
    500502      } 
     
    692694    access.changeAccess(ent, aces); 
    693695    sess.saveOrUpdate(ent); 
    694   } 
    695  
    696   public Acl getAcl(BwShareableDbentity ent) throws CalFacadeException { 
    697     checkOpen(); 
    698     return access.getAcl(ent); 
    699696  } 
    700697 
  • trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/HibSession.java

    r300 r331  
    249249  } 
    250250 
     251  /** Return true if we have a transaction started 
     252   *  
     253   * @return boolean 
     254   */ 
     255  public boolean transactionStarted() { 
     256    return tx != null; 
     257  } 
     258   
    251259  /** Commit a transaction 
    252260   * 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java

    r321 r331  
    8686import org.apache.log4j.Logger; 
    8787 
    88 import edu.rpi.cct.uwcal.access.Acl; 
    89  
    9088/** Base Implementation of CalIntf which throws exceptions for most methods. 
    9189* 
     
    378376  } 
    379377 
    380   public Acl getAcl(BwShareableDbentity ent) throws CalFacadeException { 
    381     checkOpen(); 
    382     throw new CalFacadeUnimplementedException(); 
    383   } 
    384  
    385378  /* ==================================================================== 
    386379   *                   Timezones 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/Calintf.java

    r314 r331  
    6868import org.bedework.calfacade.filter.BwFilter; 
    6969import org.bedework.calfacade.ifs.Groups; 
    70  
    71 import edu.rpi.cct.uwcal.access.Acl; 
    7270 
    7371import java.util.Collection; 
     
    365363                           Collection aces) throws CalFacadeException; 
    366364 
    367   /** Return the acl representing the allowed access for the given object. This 
    368    * may be derived from an object higher up the tree. 
    369    * 
    370    * @param ent 
    371    * @return Acl 
    372    * @throws CalFacadeException 
    373    */ 
    374   public Acl getAcl(BwShareableDbentity ent) throws CalFacadeException; 
    375  
    376365  /* ==================================================================== 
    377366   *                   Timezones 
  • trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/EventsI.java

    r321 r331  
    156156   * @param cal        CalendarVO object 
    157157   * @param val        String possible name 
    158    * @return Collection of EventVO or null 
     158   * @return Collection of CoreEventInfo objects 
    159159   * @throws CalFacadeException 
    160160   */ 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWIntf.java

    r320 r331  
    289289      CaldavComponentNode cnode = (CaldavComponentNode)uwnode; 
    290290 
    291       BwEvent ev = cnode.getEvent(); 
     291      BwEvent ev = cnode.getEventInfo().getEvent(); 
    292292 
    293293      if (ev != null) { 
     
    808808        svci.updateCalendar(cal); 
    809809      } else { 
    810         BwEvent ev = ((CaldavComponentNode)node).getEvent(); 
     810        BwEvent ev = ((CaldavComponentNode)node).getEventInfo().getEvent(); 
    811811 
    812812        svci.changeAccess(ev, info.aces); 
     
    827827    try { 
    828828      if (cdUri.isCalendar()) { 
    829         acl = getSvci().getAcl(cdUri.getCal())
     829        acl = cdUri.getCal().getCurrentAccess().acl
    830830      } else { 
    831         acl = getSvci().getAcl(((CaldavComponentNode)node).getEvent())
     831        acl = ((CaldavComponentNode)node).getEventInfo().getCurrentAccess().acl
    832832      } 
    833833 
  • trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavComponentNode.java

    r2 r331  
    5656 
    5757import org.bedework.calfacade.BwEvent; 
     58import org.bedework.calfacade.svc.EventInfo; 
    5859 
    5960import org.bedework.calsvci.CalSvcI; 
     
    8182public class CaldavComponentNode extends CaldavBwNode { 
    8283  /* The only event or the master */ 
    83   private BwEvent event; 
     84//  private BwEvent event; 
     85  private EventInfo eventInfo; 
    8486 
    8587  /* Collection of BwEvent for this node 
     
    126128 
    127129    try { 
    128       if ((event != null) && (vevent == null)) { 
    129         Calendar ical = trans.toIcal(event); 
     130      if ((eventInfo != null) && (vevent == null)) { 
     131        Calendar ical = trans.toIcal(eventInfo.getEvent()); 
    130132        if (events.size() == 1) { 
    131133          this.ical = ical; // Save doing it again 
     
    160162 
    161163    try { 
    162       if ((event == null) && exists) { 
     164      if ((eventInfo == null) && exists) { 
    163165        String entityName = cdURI.getEntityName(); 
    164166 
     
    181183          if (events.size() == 1) { 
    182184            /* Non recurring or no overrides */ 
    183             event = (BwEvent)events.iterator().next(); 
     185            eventInfo = (EventInfo)events.iterator().next(); 
    184186          } else { 
    185187            /* Find the master */ 
     
    187189            Iterator it = events.iterator(); 
    188190            while (it.hasNext()) { 
    189               BwEvent ev = (BwEvent)it.next(); 
    190  
    191               if (ev.getRecurring()) { 
    192                 event = ev
     191              EventInfo ei = (EventInfo)it.next(); 
     192 
     193              if (ei.getEvent().getRecurring()) { 
     194                eventInfo = ei
    193195              } 
    194196            } 
    195197 
    196             if (event == null) { 
     198            if (eventInfo == null) { 
    197199              throw new WebdavIntfException("Missing master for " + cdURI); 
    198200            } 
     
    201203      } 
    202204 
    203       if (event != null) { 
     205      if (eventInfo != null) { 
     206        BwEvent event = eventInfo.getEvent(); 
     207         
    204208        creDate = event.getCreated(); 
    205209        lastmodDate = event.getLastmod(); 
     
    226230  /** Returns the only event or the master event for a recurrence 
    227231   * 
    228    * @return BwEvent 
     232   * @return EventInfo 
    229233   * @throws WebdavIntfException 
    230234   */ 
    231   public BwEvent getEvent() throws WebdavIntfException { 
    232     init(true); 
    233  
    234     return event
     235  public EventInfo getEventInfo() throws WebdavIntfException { 
     236    init(true); 
     237 
     238    return eventInfo
    235239  } 
    236240 
     
    245249      if (ical == null) { 
    246250        if (events.size() == 1) { 
    247           ical = trans.toIcal(event); 
     251          ical = trans.toIcal(eventInfo.getEvent()); 
    248252        } else { 
    249253          // recurring 
  • trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java

    r321 r331  
    9898//import org.bedework.mail.MailerIntf; 
    9999 
    100 import edu.rpi.cct.uwcal.access.Acl; 
    101100import edu.rpi.cct.uwcal.resources.Resources; 
    102101 
     
    568567                           Collection aces) throws CalFacadeException { 
    569568    getCal().changeAccess(ent, aces); 
    570   } 
    571  
    572   public Acl getAcl(BwShareableDbentity ent) throws CalFacadeException { 
    573     return getCal().getAcl(ent); 
    574569  } 
    575570 
     
    17371732  public Collection findEventsByName(BwCalendar cal, String val) 
    17381733          throws CalFacadeException { 
    1739     return getCal().getEventsByName(cal, val); 
     1734    return postProcess(getCal().getEventsByName(cal, val), (BwSubscription)null); 
    17401735  } 
    17411736 
  • trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java

    r321 r331  
    8282import org.bedework.icalendar.IcalCallback; 
    8383 
    84 import edu.rpi.cct.uwcal.access.Acl; 
    8584import edu.rpi.cct.uwcal.resources.Resources; 
    8685 
     
    410409 public abstract void changeAccess(BwShareableDbentity ent,  
    411410                                   Collection aces) throws CalFacadeException; 
    412  
    413  /** Return the ace representing the allowed access for the given object. This 
    414   * may be derived from an object higher up the tree. 
    415   * 
    416   * @param ent 
    417   * @return Acl 
    418   * @throws CalFacadeException 
    419   */ 
    420  public abstract Acl getAcl(BwShareableDbentity ent) throws CalFacadeException; 
    421411 
    422412  /* ==================================================================== 
     
    12431233   * a new purpose, which indicates the event is hidden for this user. 
    12441234   * 
    1245    * @param  event          EventVO object 
     1235   * @param  event          BwEvent object 
    12461236   * @return  boolean       false for no such item. 
    12471237   * @throws CalFacadeException 
     
    12621252   * @param cal        CalendarVO object 
    12631253   * @param val        String possible name 
    1264    * @return Collection of EventVO or null 
     1254   * @return Collection of EventInfo or null 
    12651255   * @throws CalFacadeException 
    12661256   */ 
  • trunk/calendar3/lib/tlds/bedework.tld

    r320 r331  
    5858    <tagclass>org.bedework.webcommon.taglib.EmitCurrentPrivsTag</tagclass> 
    5959    <bodycontent>empty</bodycontent> 
    60     <info>Emit txt in a tag</info> 
     60    <info>Emit xml version of current privs in a tag</info> 
    6161 
    6262    <attribute> 
     
    8484    </attribute> 
    8585  </tag> 
     86 
     87  <tag> 
     88    <name>emitAcl</name> 
     89    <tagclass>org.bedework.webcommon.taglib.EmitAclTag</tagclass> 
     90    <bodycontent>empty</bodycontent> 
     91    <info>Emit xml version of acl in a tag</info> 
     92 
     93    <attribute> 
     94      <name>name</name> 
     95      <required>true</required> 
     96      <rtexprvalue>false</rtexprvalue> 
     97    </attribute> 
     98 
     99    <attribute> 
     100      <name>property</name> 
     101      <required>false</required> 
     102      <rtexprvalue>false</rtexprvalue> 
     103    </attribute> 
     104 
     105    <attribute> 
     106      <name>scope</name> 
     107      <required>false</required> 
     108      <rtexprvalue>false</rtexprvalue> 
     109    </attribute> 
     110  </tag> 
    86111</taglib> 
    87112 
  • trunk/calendar3/webclient/war/docs/calendar/emitCalendar.jsp

    r320 r331  
    1111  <bw:emitText name="calendar" property="mailListId" /> 
    1212  <bw:emitCurrentPrivs name="calendar" property="currentAccess" /> 
     13  <bw:emitAcl name="calendar" property="currentAccess" /> 
    1314 
    1415  <logic:iterate name="calendar" property="children" id="cal"> 
  • trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java

    r302 r331  
    468468         */ 
    469469 
    470         String reqpar = request.getParameter("adminGroupName"); 
     470        String reqpar = getReqPar(request, "adminGroupName"); 
    471471        if (reqpar == null) { 
    472472          // Make them do it again. 
     
    591591 
    592592    BwAdminGroup ag = (BwAdminGroup)adgrps.findGroup(groupName); 
     593    if (ag != null) { 
     594      adgrps.getMembers(ag); 
     595    } 
    593596 
    594597    if (debug) { 
     
    933936        par.svlt = servlet; 
    934937        par.req = request; 
    935  
    936         try { 
    937           ua = svci.getUserAuth(user, par); 
    938  
    939           form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); 
    940           svci.setSuperUser((ua.getUsertype() & UserAuth.superUser) != 0); 
    941  
    942           // XXX access - disable use of roles 
    943           access = ua.getUsertype(); 
    944            
    945           if (debug) { 
    946             debugMsg("UserAuth says that current user has the type: " + 
    947                      ua.getUsertype()); 
     938         
     939        if (publicAdmin) { 
     940          try { 
     941            ua = svci.getUserAuth(user, par); 
     942             
     943            form.assignAuthorisedUser(ua.getUsertype() != UserAuth.noPrivileges); 
     944            svci.setSuperUser((ua.getUsertype() & UserAuth.superUser) != 0); 
     945             
     946            // XXX access - disable use of roles 
     947            access = ua.getUsertype(); 
     948             
     949            if (debug) { 
     950              debugMsg("UserAuth says that current user has the type: " + 
     951                       ua.getUsertype()); 
     952            } 
     953          } catch (Throwable t) { 
     954            form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); 
     955            form.getErr().emit(t); 
     956            return false; 
    948957          } 
    949         } catch (Throwable t) { 
    950           form.getErr().emit("org.bedework.client.error.exc", t.getMessage()); 
    951           form.getErr().emit(t); 
    952           return false; 
    953958        } 
    954959      } catch (CalFacadeException cfe) {