Changeset 314
- Timestamp:
- 03/31/06 11:17:40
- Files:
-
- trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Access.java (modified) (9 diffs)
- trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Ace.java (modified) (5 diffs)
- trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Acl.java (modified) (12 diffs)
- trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Privilege.java (modified) (2 diffs)
- trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Privileges.java (modified) (10 diffs)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/AccessUtil.java (modified) (3 diffs)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/EventFormatter.java (modified) (6 diffs)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/FormattedEvents.java (modified) (5 diffs)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/TimeView.java (modified) (1 diff)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/TimeViewDailyInfo.java (modified) (1 diff)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/AccessUtil.java (modified) (4 diffs)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java (modified) (2 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java (modified) (2 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/Calintf.java (modified) (2 diffs)
- trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWIntf.java (modified) (4 diffs)
- trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java (modified) (2 diffs)
- trunk/calendar3/calsvci/build.xml (modified) (1 diff)
- trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java (modified) (2 diffs)
- trunk/calendar3/common/src/edu/rpi/sss/util/xml/XmlEmit.java (modified) (4 diffs)
- trunk/calendar3/test/src/org/bedework/tests/access/AccessTest.java (modified) (3 diffs)
- trunk/calendar3/webadmin/src/org/bedework/webadmin/event/PEGetFormattedEventsAction.java (modified) (1 diff)
- trunk/calendar3/webclient/src/org/bedework/webclient/BwAccessAction.java (modified) (3 diffs)
- trunk/calendar3/webclient/src/org/bedework/webclient/BwEventAction.java (modified) (1 diff)
- trunk/calendar3/webclient/war/docs/event/emitEventAll.jsp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Access.java
r310 r314 69 69 private boolean debug; 70 70 71 /** The acl we use for evaluation of access.72 */73 private final static Acl acl = new Acl();74 75 71 /** Defines no access */ 76 public final static Privilege none = acl.makePriv(Privileges.privNone);72 public final static Privilege none = Privileges.makePriv(Privileges.privNone); 77 73 78 74 /** Defines full access to an object */ 79 public final static Privilege all = acl.makePriv(Privileges.privAll);75 public final static Privilege all = Privileges.makePriv(Privileges.privAll); 80 76 81 77 /** Defines read access to an object */ 82 public final static Privilege read = acl.makePriv(Privileges.privRead);78 public final static Privilege read = Privileges.makePriv(Privileges.privRead); 83 79 84 80 /** Defines write access to an object */ 85 public final static Privilege write = acl.makePriv(Privileges.privWrite);81 public final static Privilege write = Privileges.makePriv(Privileges.privWrite); 86 82 87 83 /** Defines write access to an object */ 88 public final static Privilege writeContent = acl.makePriv(Privileges.privWriteContent);84 public final static Privilege writeContent = Privileges.makePriv(Privileges.privWriteContent); 89 85 90 86 /** Privilege set giving read access to an object */ … … 96 92 /** Default access for public entities 97 93 */ 98 private static String defaultPublicAccess;94 private static volatile String defaultPublicAccess; 99 95 100 96 /** Default access for personal entities 101 97 */ 102 private static String defaultPersonalAccess; 103 98 private static volatile String defaultPersonalAccess; 99 100 static { 101 Acl acl = new Acl(); 102 103 try { 104 /** Public - write owner, read others, read unauthenticated */ 105 acl.clear(); 106 acl.addAce(new Ace(null, false, Ace.whoTypeOwner, all)); 107 acl.addAce(new Ace(null, false, Ace.whoTypeOther, read)); 108 acl.addAce(new Ace(null, false, Ace.whoTypeUnauthenticated, read)); 109 defaultPublicAccess = new String(acl.encode()); 110 111 acl.clear(); 112 acl.addAce(new Ace(null, false, Ace.whoTypeOwner, all)); 113 acl.addAce(new Ace(null, false, Ace.whoTypeOther, none)); 114 defaultPersonalAccess = new String(acl.encode()); 115 } catch (Throwable t) { 116 throw new RuntimeException(t); 117 } 118 } 119 104 120 /** Constructor 105 121 * … … 109 125 public Access(boolean debug) throws AccessException { 110 126 this.debug = debug; 111 acl.setDebug(debug);112 113 /** Calculate default access strings */114 115 /** Public - write owner, read others, read unauthenticated */116 acl.clear();117 acl.addAce(new Ace(null, false, Ace.whoTypeOwner, all));118 acl.addAce(new Ace(null, false, Ace.whoTypeOther, read));119 acl.addAce(new Ace(null, false, Ace.whoTypeUnauthenticated, read));120 defaultPublicAccess = new String(acl.encode());121 122 acl.clear();123 acl.addAce(new Ace(null, false, Ace.whoTypeOwner, all));124 acl.addAce(new Ace(null, false, Ace.whoTypeOther, none));125 defaultPersonalAccess = new String(acl.encode());126 127 } 127 128 … … 148 149 */ 149 150 public Privilege makePriv(int priv) { 150 return acl.makePriv(priv); 151 } 152 153 /** Get the Privileges object from the defautl acl 154 * 155 * @param privs Privileges 156 * @return Privilege object defining access 157 */ 158 public static Privileges getPrivs() { 159 return acl.getPrivs(); 151 return Privileges.makePriv(priv); 160 152 } 161 153 … … 198 190 Privilege[] how, String aclString) 199 191 throws AccessException { 200 return acl.evaluateAccess(who, owner, how, aclString.toCharArray());192 return new Acl(debug).evaluateAccess(who, owner, how, aclString.toCharArray()); 201 193 } 202 194 … … 213 205 Privilege[] how, char[] aclChars) 214 206 throws AccessException { 215 return acl.evaluateAccess(who, owner, how, aclChars);207 return new Acl(debug).evaluateAccess(who, owner, how, aclChars); 216 208 } 217 209 … … 227 219 char[] aclChars) 228 220 throws AccessException { 229 return acl.evaluateAccess(who, owner, privSetRead, aclChars);221 return new Acl(debug).evaluateAccess(who, owner, privSetRead, aclChars); 230 222 } 231 223 … … 241 233 char[] aclChars) 242 234 throws AccessException { 243 return acl.evaluateAccess(who, owner, privSetReadWrite, aclChars);235 return new Acl(debug).evaluateAccess(who, owner, privSetReadWrite, aclChars); 244 236 } 245 237 … … 256 248 int priv, char[] aclChars) 257 249 throws AccessException { 258 if (debug) { 259 } 260 261 return acl.evaluateAccess(who, owner, 262 new Privilege[]{acl.makePriv(priv)}, 263 aclChars); 250 return new Acl(debug).evaluateAccess(who, owner, 251 new Privilege[]{Privileges.makePriv(priv)}, 252 aclChars); 264 253 } 265 254 } trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Ace.java
r2 r314 374 374 * @param acl 375 375 * @param privs 376 * @param getPrivileges377 376 * @param name 378 377 * @param whoType … … 381 380 */ 382 381 public boolean decode(EncodedAcl acl, 383 Privileges privs,384 382 boolean getPrivileges, 385 383 String name, int whoType) throws AccessException { … … 390 388 391 389 if ((whoType != getWhoType()) || !whoMatch(name)) { 392 skipHow(acl , privs);390 skipHow(acl); 393 391 } else { 394 decodeHow(acl, privs,getPrivileges);392 decodeHow(acl, getPrivileges); 395 393 return true; 396 394 } … … 407 405 * 408 406 * @param acl 409 * @param privs410 407 * @param getPrivileges 411 408 * @throws AccessException 412 409 */ 413 410 public void decode(EncodedAcl acl, 414 Privileges privs,415 411 boolean getPrivileges) throws AccessException { 416 412 decodeWhoType(acl); 417 decodeHow(acl, privs,getPrivileges);413 decodeHow(acl, getPrivileges); 418 414 } 419 415 … … 659 655 } 660 656 661 private void skipHow(EncodedAcl acl, 662 Privileges privs) throws AccessException { 663 privs.skip(acl); 657 private void skipHow(EncodedAcl acl) throws AccessException { 658 Privileges.skip(acl); 664 659 } 665 660 666 661 private void decodeHow(EncodedAcl acl, 667 Privileges privs,668 662 boolean getPrivileges) throws AccessException { 669 663 int pos = acl.getPos(); 670 setHow( privs.fromEncoding(acl));664 setHow(Privileges.fromEncoding(acl)); 671 665 if (getPrivileges) { 672 666 acl.setPos(pos); 673 setPrivs( privs.getPrivs(acl));667 setPrivs(Privileges.getPrivs(acl)); 674 668 } 675 669 } trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Acl.java
r120 r314 83 83 boolean debug; 84 84 85 Privileges privs;86 87 85 private TreeSet aces; 88 86 … … 105 103 public Acl(boolean debug) { 106 104 this.debug = debug; 107 privs = new Privileges();108 105 } 109 106 … … 184 181 getPrivileges: { 185 182 if (!authenticated) { 186 if (ace.decode(this, privs,false, null, Ace.whoTypeUnauthenticated)) {183 if (ace.decode(this, false, null, Ace.whoTypeUnauthenticated)) { 187 184 privileges = ace.getHow(); 188 185 } … … 192 189 193 190 if (isOwner) { 194 if (ace.decode(this, privs,false, null, Ace.whoTypeOwner)) {191 if (ace.decode(this, false, null, Ace.whoTypeOwner)) { 195 192 privileges = ace.getHow(); 196 193 } else { … … 202 199 203 200 // Not owner - look for user 204 if (ace.decode(this, privs,false, who.getAccount(), Ace.whoTypeUser)) {201 if (ace.decode(this, false, who.getAccount(), Ace.whoTypeUser)) { 205 202 privileges = ace.getHow(); 206 203 if (debug) { … … 221 218 debugsb.append("...Try access for group " + group); 222 219 } 223 if (ace.decode(this, privs,false, group, Ace.whoTypeGroup)) {220 if (ace.decode(this, false, group, Ace.whoTypeGroup)) { 224 221 privileges = mergePrivileges(privileges, ace.getHow()); 225 222 } … … 236 233 237 234 // "other" access set? 238 if (ace.decode(this, privs,false, null, Ace.whoTypeOther)) {235 if (ace.decode(this, false, null, Ace.whoTypeOther)) { 239 236 privileges = ace.getHow(); 240 237 … … 303 300 } 304 301 305 /**306 * @return Privileges307 */308 public Privileges getPrivs() {309 return privs;310 }311 312 302 /** Set the ace collection for this acl 313 303 * … … 340 330 } 341 331 342 /**343 * @param privType344 * @return Privilege345 */346 public Privilege makePriv(int privType) {347 return privs.makePriv(privType);348 }349 350 332 /** Set to default access 351 333 * … … 355 337 356 338 addAce(new Ace(null, false, Ace.whoTypeOwner, 357 privs.makePriv(Privileges.privAll)));339 Privileges.makePriv(Privileges.privAll))); 358 340 359 341 addAce(new Ace(null, false, Ace.whoTypeOther, 360 privs.makePriv(Privileges.privNone)));342 Privileges.makePriv(Privileges.privNone))); 361 343 } 362 344 … … 421 403 Ace ace = new Ace(); 422 404 423 ace.decode(this, privs,true);405 ace.decode(this, true); 424 406 425 407 ts.add(ace); … … 452 434 Ace ace = new Ace(); 453 435 454 ace.decode(this, privs,true);436 ace.decode(this, true); 455 437 ace.setInherited(true); 456 438 trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Privilege.java
r2 r314 54 54 package edu.rpi.cct.uwcal.access; 55 55 56 import java.util.ArrayList; 56 57 import java.util.Iterator; 57 import java.util.Vector;58 58 59 59 /** Define the properties of a privilege for the calendar. … … 83 83 private char encoding; 84 84 85 private Vector containedPrivileges = new Vector();85 private ArrayList containedPrivileges = new ArrayList(); 86 86 87 87 /** Constructor trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Privileges.java
r2 r314 101 101 */ 102 102 103 private Privilege[] privs; 104 105 /** Constructor 106 * 107 */ 108 public Privileges() { 109 privs = new Privilege[privMaxType + 1]; 110 103 private final static Privilege[] privs = new Privilege[privMaxType + 1]; 104 105 static { 111 106 privs[privAll] = new Privilege("all", "All privileges", false, false, 112 privAll);107 privAll); 113 108 114 109 privs[privRead] = new Privilege("read", "Read any calendar object", false, false, 115 privRead);116 110 privRead); 111 117 112 privs[privReadAcl] = new Privilege("read-acl", "Read calendar accls", false, false, 118 privReadAcl);119 113 privReadAcl); 114 120 115 privs[privReadCurrentUserPrivilegeSet] = 121 116 new Privilege("read-current-user-privilege-set", 122 117 "Read current user privilege set property", false, false, 123 118 privReadCurrentUserPrivilegeSet); 124 125 privs[privReadFreeBusy] = new Privilege("view-free-busy", "View a users free busy information", false, false, 126 privReadFreeBusy); 127 119 120 privs[privReadFreeBusy] = new Privilege("view-free-busy", 121 "View a users free busy information", 122 false, false, privReadFreeBusy); 123 128 124 privs[privWrite] = new Privilege("write", "Write any calendar object", false, false, 129 privWrite);130 125 privWrite); 126 131 127 privs[privWriteAcl] = new Privilege("write-acl", "Write ACL", false, false, 132 privWriteAcl);133 128 privWriteAcl); 129 134 130 privs[privWriteProperties] = new Privilege("write-properties", "Write calendar properties", false, false, 135 privWriteProperties);136 131 privWriteProperties); 132 137 133 privs[privWriteContent] = new Privilege("write-content", "Write calendar content", false, false, 138 privWriteContent);139 134 privWriteContent); 135 140 136 privs[privBind] = new Privilege("create", "Create a calendar object", false, false, 141 privBind);142 137 privBind); 138 143 139 privs[privUnbind] = new Privilege("delete", "Delete a calendar object", false, false, 144 privUnbind);145 140 privUnbind); 141 146 142 privs[privUnlock] = new Privilege("unlock", "Remove a lock", false, false, 147 privUnlock);148 143 privUnlock); 144 149 145 privs[privNone] = (Privilege)privs[privAll].clone(); 150 146 privs[privNone].setDenial(true); 151 147 152 148 privs[privAll].addContainedPrivilege(privs[privRead]); 153 149 privs[privAll].addContainedPrivilege(privs[privWrite]); 154 150 privs[privAll].addContainedPrivilege(privs[privUnlock]); 155 151 156 152 privs[privRead].addContainedPrivilege(privs[privReadAcl]); 157 153 privs[privRead].addContainedPrivilege(privs[privReadCurrentUserPrivilegeSet]); 158 154 privs[privRead].addContainedPrivilege(privs[privReadFreeBusy]); 159 155 160 156 privs[privWrite].addContainedPrivilege(privs[privWriteAcl]); 161 157 privs[privWrite].addContainedPrivilege(privs[privWriteProperties]); … … 165 161 } 166 162 163 /** Constructor 164 * 165 */ 166 private Privileges() { 167 } 168 167 169 /** 168 170 * @return Privilege defining all access 169 171 */ 170 public Privilege getPrivAll() {172 public static Privilege getPrivAll() { 171 173 return privs[privAll]; 172 174 } … … 175 177 * @return Privilege defining no access 176 178 */ 177 public Privilege getPrivNone() {179 public static Privilege getPrivNone() { 178 180 return privs[privNone]; 179 181 } … … 184 186 * @return Privilege defining access 185 187 */ 186 public Privilege makePriv(int privType) {188 public static Privilege makePriv(int privType) { 187 189 return (Privilege)privs[privType].clone(); 188 190 } … … 195 197 * @throws AccessException 196 198 */ 197 public char[] fromEncoding(EncodedAcl acl) throws AccessException {199 public static char[] fromEncoding(EncodedAcl acl) throws AccessException { 198 200 char[] privStates = { 199 201 unspecified, // privAll … … 236 238 * @throws AccessException 237 239 */ 238 public void skip(EncodedAcl acl) throws AccessException {240 public static void skip(EncodedAcl acl) throws AccessException { 239 241 while (acl.hasMore()) { 240 242 if (acl.getChar() == ' ') { … … 251 253 * @throws AccessException 252 254 */ 253 public Collection getPrivs(EncodedAcl acl) throws AccessException {255 public static Collection getPrivs(EncodedAcl acl) throws AccessException { 254 256 Vector v = new Vector(); 255 257 … … 272 274 } 273 275 274 private void setState(char[] states, Privilege p, boolean denial) {276 private static void setState(char[] states, Privilege p, boolean denial) { 275 277 if (!denial) { 276 278 states[p.getIndex()] = allowed; … … 290 292 * that matches the privilege in the acl. 291 293 */ 292 private Privilege findPriv(Privilege p, EncodedAcl acl)294 private static Privilege findPriv(Privilege p, EncodedAcl acl) 293 295 throws AccessException { 294 296 if (p.match(acl)) { … … 308 310 return null; 309 311 } 310 311 /* ====================================================================312 * Object methods313 * ==================================================================== */314 /*315 public int hashCode() {316 return 31 * entityId * entityType;317 }318 319 public boolean equals(Object obj) {320 if (this == obj) {321 return true;322 }323 324 if (obj == null) {325 return false;326 }327 328 if (!(obj instanceof AttendeeVO)) {329 return false;330 }331 332 AttendeePK that = (AttendeePK)obj;333 334 return (entityId == that.entityId) &&335 (entityType == that.entityType);336 }337 */338 339 public String toString() {340 StringBuffer sb = new StringBuffer();341 342 sb.append("AclVO{");343 // sb.append(entityId);344 sb.append("}");345 346 return sb.toString();347 }348 349 /*350 public Object clone() {351 return new AttendeePK(getEntityId(),352 getEntityType());353 }*/354 312 } 355 313 trunk/calendar3/appcommon/src/org/bedework/appcommon/AccessUtil.java
r313 r314 58 58 import org.bedework.davdefs.WebdavTags; 59 59 60 import edu.rpi.cct.uwcal.access.Access;61 60 import edu.rpi.cct.uwcal.access.Ace; 62 61 import edu.rpi.cct.uwcal.access.Acl; 63 62 import edu.rpi.cct.uwcal.access.Privilege; 63 import edu.rpi.cct.uwcal.access.Privileges; 64 64 import edu.rpi.sss.util.xml.QName; 65 65 import edu.rpi.sss.util.xml.XmlEmit; 66 66 67 67 import java.io.Serializable; 68 import java.io.StringWriter; 68 69 import java.util.Collection; 69 70 import java.util.Iterator; … … 100 101 this.xml = xml; 101 102 } 103 104 public static String getXmlString(Acl acl) throws CalFacadeException { 105 try { 106 XmlEmit xml = new XmlEmit(true); // no headers 107 StringWriter su = new StringWriter(); 108 xml.startEmit(su); 109 AccessUtil au = new AccessUtil(xml); 110 111 au.emitAcl(acl); 112 113 su.close(); 114 115 return su.toString(); 116 } catch (CalFacadeException cfe) { 117 throw cfe; 118 } catch (Throwable t) { 119 throw new CalFacadeException(t); 120 } 121 } 102 122 103 123 /** (Re)set the xml writer … … 170 190 xml.openTag(WebdavTags.supportedPrivilegeSet); 171 191 172 emitSupportedPriv( Access.getPrivs().getPrivAll());192 emitSupportedPriv(Privileges.getPrivAll()); 173 193 174 194 xml.closeTag(WebdavTags.supportedPrivilegeSet); trunk/calendar3/appcommon/src/org/bedework/appcommon/EventFormatter.java
r278 r314 59 59 import org.bedework.calfacade.ifs.CalTimezones; 60 60 import org.bedework.calfacade.svc.EventInfo; 61 import org.bedework.calsvci.CalSvcI; 61 62 62 63 import java.io.Serializable; … … 65 66 66 67 import org.apache.log4j.Logger; 68 69 import edu.rpi.cct.uwcal.access.Acl; 67 70 68 71 /** Object to provide formatting services for a BwEvent. … … 78 81 79 82 private CalTimezones ctz; 83 84 private CalSvcI svci; 80 85 81 86 /** The view currently in place. … … 83 88 //private TimeView view; 84 89 85 /* *Set so that questions can be asked about the time */90 /* Set so that questions can be asked about the time */ 86 91 private MyCalendarVO today; 87 92 88 /* *Set dynamically on request to represent start date/time */93 /* Set dynamically on request to represent start date/time */ 89 94 private DateTimeFormatter start; 90 95 91 /* *Set dynamically on request to represent end date/time */96 /* Set dynamically on request to represent end date/time */ 92 97 private DateTimeFormatter end; 93 98 99 private String xmlAccess; 100 94 101 /** Constructor 95 102 * … … 99 106 * @param ctz 100 107 */ 101 public EventFormatter( EventInfo eventInfo, TimeView view,108 public EventFormatter(CalSvcI svci, EventInfo eventInfo, TimeView view, 102 109 CalendarInfo calInfo, CalTimezones ctz) { 103 110 this.eventInfo = eventInfo; 104 111 this.calInfo = calInfo; 105 112 this.ctz= ctz; 113 this.svci = svci; 106 114 } 107 115 … … 198 206 return end; 199 207 } 208 209 public String getXmlAccess() { 210 try { 211 if (xmlAccess == null) { 212 Acl acl = svci.getAcl(getEvent()); 213 xmlAccess = AccessUtil.getXmlString(acl); 214 } 215 } catch (Throwable t) { 216 error(t); 217 } 218 219 return xmlAccess; 220 } 200 221 201 222 /* =================================================================== trunk/calendar3/appcommon/src/org/bedework/appcommon/FormattedEvents.java
r297 r314 57 57 import org.bedework.calfacade.ifs.CalTimezones; 58 58 import org.bedework.calfacade.svc.EventInfo; 59 import org.bedework.calsvci.CalSvcI; 59 60 60 61 import java.util.AbstractCollection; … … 71 72 private CalendarInfo calInfo; 72 73 private CalTimezones ctz; 74 private CalSvcI svci; 73 75 74 76 /** Constructor … … 78 80 * @param ctz 79 81 */ 80 public FormattedEvents(C ollection events,82 public FormattedEvents(CalSvcI svci, Collection events, 81 83 CalendarInfo calInfo, CalTimezones ctz) { 82 84 if (events == null) { … … 87 89 this.calInfo = calInfo; 88 90 this.ctz = ctz; 91 this.svci = svci; 89 92 } 90 93 … … 111 114 EventInfo ev = (EventInfo)it.next(); 112 115 113 return new EventFormatter( ev, null, calInfo, ctz);116 return new EventFormatter(svci, ev, null, calInfo, ctz); 114 117 } 115 118 trunk/calendar3/appcommon/src/org/bedework/appcommon/TimeView.java
r297 r314 162 162 return cal.getTimezones(); 163 163 } 164 165 /** 166 * @return CalSvcI 167 */ 168 public CalSvcI getSvcI() { 169 return cal; 170 } 164 171 165 172 /** Override this for a single day view trunk/calendar3/appcommon/src/org/bedework/appcommon/TimeViewDailyInfo.java
r297 r314 565 565 566 566 while (it.hasNext()) { 567 eventFormatters.add(new EventFormatter((EventInfo)it.next(), view, 568 calInfo, view.getTimezones())); 567 eventFormatters.add(new EventFormatter(view.getSvcI(), 568 (EventInfo)it.next(), view, 569 calInfo, view.getTimezones())); 569 570 } 570 571 } trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/AccessUtil.java
r310 r314 169 169 public void changeAccess(BwShareableDbentity ent, 170 170 Collection aces) throws CalFacadeException { 171 Collection oldAces = getAces(ent); 172 173 try { 174 Acl acl = new Acl(debug); 175 acl.setAces(oldAces); 171 try { 172 Acl acl = getAces(ent, privWriteAcl); 176 173 177 174 Iterator it = aces.iterator(); … … 189 186 } 190 187 191 /** Return the ac esrepresenting the allowed access for the given object. This188 /** Return the acl representing the allowed access for the given object. This 192 189 * may be derived from an object higher up the tree. 193 190 * 194 * @param o195 * @return Collection191 * @param ent 192 * @return Acl 196 193 * @throws CalFacadeException 197 194 */ 198 public Collection getAces(BwShareableDbentity ent) throws CalFacadeException { 199 return getAces(ent, privWriteAcl); 195 public Acl getAcl(BwShareableDbentity ent) throws CalFacadeException { 196 try { 197 return getAces(ent, privReadAcl); 198 } catch (CalFacadeAccessException cae) { 199 Acl acl = new Acl(); 200 acl.defaultAccess(); 201 202 return acl; 203 } catch (Throwable t) { 204 throw new CalFacadeException(t); 205 } 200 206 } 201 207 … … 264 270 * @throws CalFacadeException 265 271 */ 266 CollectiongetAces(BwShareableDbentity ent, int desiredAccess)272 Acl getAces(BwShareableDbentity ent, int desiredAccess) 267 273 throws CalFacadeException { 268 274 if (ent == null) { … … 288 294 acl.decode(aclChars); 289 295 290 return acl .getAces();296 return acl; 291 297 } catch (Throwable t) { 292 298 throw new CalFacadeException(t); trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java
r310 r314 54 54 package org.bedework.calcore.hibernate; 55 55 56 import edu.rpi.cct.uwcal.access.Acl; 56 57 import edu.rpi.cct.uwcal.access.PrivilegeDefs; 57 58 … … 692 693 } 693 694 694 public Collection getAces(BwShareableDbentity ent) throws CalFacadeException {695 checkOpen(); 696 return access.getAc es(ent);695 public Acl getAcl(BwShareableDbentity ent) throws CalFacadeException { 696 checkOpen(); 697 return access.getAcl(ent); 697 698 } 698 699 trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java
r310 r314 85 85 import org.apache.log4j.Logger; 86 86 87 import edu.rpi.cct.uwcal.access.Acl; 88 87 89 /** Base Implementation of CalIntf which throws exceptions for most methods. 88 90 * … … 375 377 } 376 378 377 public Collection getAces(BwShareableDbentity ent) throws CalFacadeException {379 public Acl getAcl(BwShareableDbentity ent) throws CalFacadeException { 378 380 checkOpen(); 379 381 throw new CalFacadeUnimplementedException(); trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/Calintf.java
r310 r314 68 68 import org.bedework.calfacade.filter.BwFilter; 69 69 import org.bedework.calfacade.ifs.Groups; 70 71 import edu.rpi.cct.uwcal.access.Acl; 70 72 71 73 import java.util.Collection; … … 363 365 Collection aces) throws CalFacadeException; 364 366 365 /** Return the ac erepresenting the allowed access for the given object. This367 /** Return the acl representing the allowed access for the given object. This 366 368 * may be derived from an object higher up the tree. 367 369 * 368 370 * @param ent 369 * @return Collection370 * @throws CalFacadeException 371 */ 372 public Collection getAces(BwShareableDbentity ent) throws CalFacadeException;371 * @return Acl 372 * @throws CalFacadeException 373 */ 374 public Acl getAcl(BwShareableDbentity ent) throws CalFacadeException; 373 375 374 376 /* ==================================================================== trunk/calendar3/caldav/src/edu/rpi/cct/uwcal/caldav/CaldavBWIntf.java
r310 r314 72 72 import edu.rpi.cct.uwcal.access.Ace; 73 73 import edu.rpi.cct.uwcal.access.Acl; 74 import edu.rpi.cct.uwcal.access.Privileges; 74 75 75 76 import edu.rpi.cct.uwcal.caldav.filter.Filter; … … 149 150 private HashMap uriMap = new HashMap(); 150 151 151 /** Used for creating ace objects */152 private static Acl acl = new Acl();153 154 152 /** An object representing the current users access 155 153 */ … … 792 790 } 793 791 794 info.aces.add(new Ace(info.who, info.notWho, info.whoType, acl.makePriv(priv))); 792 info.aces.add(new Ace(info.who, info.notWho, info.whoType, 793 Privileges.makePriv(priv))); 795 794 } 796 795 … … 824 823 CaldavBwNode uwnode = getBwnode(node); 825 824 CaldavURI cdUri = uwnode.getCDURI(); 826 Collection aces= null;825 Acl acl = null; 827 826 828 827 try { 829 828 if (cdUri.isCalendar()) { 830 ac es = getSvci().getAces(cdUri.getCal());829 acl = getSvci().getAcl(cdUri.getCal()); 831 830 } else { 832 ac es = getSvci().getAces(((CaldavComponentNode)node).getEvent());833 } 834 835 emitAccess.emitAc es(aces);831 acl = getSvci().getAcl(((CaldavComponentNode)node).getEvent()); 832 } 833 834 emitAccess.emitAcl(acl); 836 835 } catch (Throwable t) { 837 836 throw new WebdavIntfException(t); trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java
r310 r314 97 97 //import org.bedework.mail.MailerIntf; 98 98 99 import edu.rpi.cct.uwcal.access.Acl; 99 100 import edu.rpi.cct.uwcal.resources.Resources; 100 101 … … 568 569 } 569 570 570 public Collection getAces(BwShareableDbentity ent) throws CalFacadeException {571 return getCal().getAc es(ent);571 public Acl getAcl(BwShareableDbentity ent) throws CalFacadeException { 572 return getCal().getAcl(ent); 572 573 } 573 574 trunk/calendar3/calsvci/build.xml
r2 r314 34 34 <pathelement location="${org.bedework.ical.jar}"/> 35 35 <pathelement location="${org.bedework.locale.jar}"/> 36 <pathelement location="${org.bedework.access.jar}"/> 36 37 </path> 37 38 trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java
r310 r314 82 82 import org.bedework.icalendar.IcalCallback; 83 83 84 import edu.rpi.cct.uwcal.access.Acl; 84 85 import edu.rpi.cct.uwcal.resources.Resources; 85 86 … … 414 415 * 415 416 * @param ent 416 * @return Collection417 * @return Acl 417 418 * @throws CalFacadeException 418 419 */ 419 public abstract Collection getAces(BwShareableDbentity ent) throws CalFacadeException;420 public abstract Acl getAcl(BwShareableDbentity ent) throws CalFacadeException; 420 421 421 422 /* ==================================================================== trunk/calendar3/common/src/edu/rpi/sss/util/xml/XmlEmit.java
r310 r314 69 69 private Writer wtr; 70 70 private boolean mustEmitNS; 71 72 private boolean noHeaders = false; 71 73 72 74 /** We need to map the namespaces onto a set of reasonable abbreviations … … 88 90 */ 89 91 public XmlEmit() { 92 this(false); 93 } 94 95 /** construct an object which will be used to collect namespace names 96 * during the first phase and emit xml afetr startEmit is called. 97 * 98 * @param noHeaders boolean true to suppress headers 99 */ 100 public XmlEmit(boolean noHeaders) { 90 101 nsMap = new HashMap(); 91 102 nsIndex = 0; 103 this.noHeaders = noHeaders; 92 104 } 93 105 … … 108 120 public void startEmit(Writer wtr) throws IOException { 109 121 this.wtr = wtr; 110 mustEmitNS = true; 111 112 writeHeader(); 122 123 if (!noHeaders) { 124 mustEmitNS = true; 125 126 writeHeader(); 127 } 113 128 newline(); 114 129 } … … 302 317 wtr.write(tag.getLocalPart()); 303 318 304 if ( mustEmitNS) {319 if (!noHeaders && mustEmitNS) { 305 320 Iterator nss = nsMap.keySet().iterator(); 306 321 trunk/calendar3/test/src/org/bedework/tests/access/AccessTest.java
r2 r314 93 93 auserInGroup.addGroup(bgroup); 94 94 95 Privilege read = acl.makePriv(Privileges.privRead);96 Privilege write = acl.makePriv(Privileges.privWrite);95 Privilege read = Privileges.makePriv(Privileges.privRead); 96 Privilege write = Privileges.makePriv(Privileges.privWrite); 97 97 98 98 Privilege[] privSetRead = {read}; … … 113 113 acl.clear(); 114 114 acl.addAce(new Ace(null, false, Ace.whoTypeOther, 115 acl.makePriv(Privileges.privRead)));115 Privileges.makePriv(Privileges.privRead))); 116 116 encoded = logEncoded(acl, "read others"); 117 117 tryDecode(encoded, "read others"); … … 128 128 acl.clear(); 129 129 Ace ace = new Ace("agroup", false, Ace.whoTypeGroup, 130 acl.makePriv(Privileges.privRead));130 Privileges.makePriv(Privileges.privRead)); 131 131 acl.addAce(ace); 132 132 133 133 ace = new Ace("auser", false, Ace.whoTypeUser); 134 ace.addPriv( acl.makePriv(Privileges.privRead));135 ace.addPriv( acl.makePriv(Privileges.privWrite));134 ace.addPriv(Privileges.makePriv(Privileges.privRead)); 135 ace.addPriv(Privileges.makePriv(Privileges.privWrite)); 136 136 acl.addAce(ace); 137 137 encoded = logEncoded(acl, "read g=agroup,rw auser"); trunk/calendar3/webadmin/src/org/bedework/webadmin/event/PEGetFormattedEventsAction.java
r189 r314 95 95 form.assignAddingEvent(false); 96 96 97 form.setFormattedEvents(new FormattedEvents(getEvents(request, false, form), 97 form.setFormattedEvents(new FormattedEvents(form.fetchSvci(), 98 getEvents(request, false, form), 98 99 form.getCalInfo(), 99 100 form.fetchSvci().getTimezones())); trunk/calendar3/webclient/src/org/bedework/webclient/BwAccessAction.java
r55 r314 62 62 63 63 import edu.rpi.cct.uwcal.access.Ace; 64 import edu.rpi.cct.uwcal.access.Acl;65 64 import edu.rpi.cct.uwcal.access.PrivilegeDefs; 66 67 import java.util.Vector; 65 import edu.rpi.cct.uwcal.access.Privileges; 66 67 import java.util.ArrayList; 68 68 import javax.servlet.http.HttpServletRequest; 69 69 … … 94 94 */ 95 95 public class BwAccessAction extends BwCalAbstractAction { 96 /** Used for creating ace objects */97 private static Acl acl = new Acl();98 99 96 /* (non-Javadoc) 100 97 * @see org.bedework.webclient.BwCalAbstractAction#doAction(javax.servlet.http.HttpServletRequest, org.bedework.webclient.BwActionForm) … … 208 205 } 209 206 210 Vector v = new Vector();211 v.add(new Ace(who, false, whoType, acl.makePriv(desiredAccess)));207 ArrayList aces = new ArrayList(); 208 aces.add(new Ace(who, false, whoType, Privileges.makePriv(desiredAccess))); 212 209 213 210 if (calid) { 214 svci.changeAccess(cal, v);211 svci.changeAccess(cal, aces); 215 212 svci.updateCalendar(cal); 216 213 } else { 217 svci.changeAccess(ev, v);214 svci.changeAccess(ev, aces); 218 215 svci.updateEvent(ev); 219 216 } trunk/calendar3/webclient/src/org/bedework/webclient/BwEventAction.java
r55 r314 86 86 // Not export - just set up for display 87 87 88 EventFormatter ef = new EventFormatter( ev,88 EventFormatter ef = new EventFormatter(form.fetchSvci(), ev, 89 89 form.getCurTimeView(), 90 90 form.getCalInfo(), trunk/calendar3/webclient/war/docs/event/emitEventAll.jsp
r312 r314 1 1 <%@ taglib uri='struts-bean' prefix='bean' %> 2 2 <%@ taglib uri='struts-logic' prefix='logic' %> 3 <%@ taglib uri='bedework' prefix='bw' %> 4 3 5 <%-- Output any additional event fields for full format displays --%> 4 6 <logic:present name="event" property="organizer"> … … 33 35 </organizer> 34 36 </logic:iterate> 37 <bw:emitText name="eventFormatter" property="xmlAccess" tagName="access" 38 filter="no"/> 35 39
