Changeset 376
- Timestamp:
- 04/14/06 10:18:58
- Files:
-
- trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Ace.java (modified) (5 diffs)
- trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/PrivilegeDefs.java (modified) (1 diff)
- trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Privileges.java (modified) (4 diffs)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/AccessUtil.java (modified) (8 diffs)
- trunk/calendar3/webclient/src/org/bedework/webclient/BwAccessAction.java (deleted)
- trunk/calendar3/webclient/war/WEB-INF/struts-config.xml (modified) (1 diff)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/access (added)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/access/AccessAction.java (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Ace.java
r331 r376 354 354 String name, int whoType) throws AccessException { 355 355 Iterator it = acl.getAces().iterator(); 356 356 357 357 while (it.hasNext()) { 358 358 Ace ace = (Ace)it.next(); … … 360 360 if ((whoType == ace.getWhoType()) && 361 361 ((whoType == whoTypeUnauthenticated) || 362 (whoType == whoTypeOwner) || 362 (whoType == whoTypeOwner) || 363 363 ace.whoMatch(name))) { 364 364 return ace; … … 368 368 return null; 369 369 } 370 370 371 371 /* ==================================================================== 372 372 * Decoding methods … … 464 464 Privilege p = (Privilege)it.next(); 465 465 p.encode(acl); 466 } 467 468 if (inherited) { 469 acl.addChar(PrivilegeDefs.inheritedFlag); 466 470 } 467 471 … … 693 697 setPrivs(Privileges.getPrivs(acl)); 694 698 } 699 700 // See if we got an inherited flag 701 acl.back(); 702 if (acl.getChar() == PrivilegeDefs.inheritedFlag) { 703 inherited = true; 704 if (acl.getChar() != ' ') { 705 throw new AccessException("malformedAcl"); 706 } 707 } 695 708 } 696 709 } trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/PrivilegeDefs.java
r320 r376 75 75 */ 76 76 public static final char unspecified = '1'; 77 78 public static final char inheritedFlag = 'I'; 77 79 78 80 // ENUM trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Privileges.java
r331 r376 102 102 103 103 private final static Privilege[] privs = new Privilege[privMaxType + 1]; 104 104 105 105 static { 106 106 privs[privAll] = new Privilege("all", "All privileges", privAll); 107 107 108 108 privs[privRead] = new Privilege("read", "Read any calendar object", privRead); 109 110 privs[privReadAcl] = new Privilege("read-acl", "Read calendar accls", 109 110 privs[privReadAcl] = new Privilege("read-acl", "Read calendar accls", 111 111 privReadAcl); 112 112 113 113 privs[privReadCurrentUserPrivilegeSet] = 114 114 new Privilege("read-current-user-privilege-set", 115 "Read current user privilege set property", 115 "Read current user privilege set property", 116 116 privReadCurrentUserPrivilegeSet); 117 118 privs[privReadFreeBusy] = new Privilege("view-free-busy", 119 "View a users free busy information", 117 118 privs[privReadFreeBusy] = new Privilege("view-free-busy", 119 "View a users free busy information", 120 120 privReadFreeBusy); 121 122 privs[privWrite] = new Privilege("write", "Write any calendar object", 121 122 privs[privWrite] = new Privilege("write", "Write any calendar object", 123 123 privWrite); 124 124 125 125 privs[privWriteAcl] = new Privilege("write-acl", "Write ACL", privWriteAcl); 126 127 privs[privWriteProperties] = new Privilege("write-properties", 128 "Write calendar properties", 126 127 privs[privWriteProperties] = new Privilege("write-properties", 128 "Write calendar properties", 129 129 privWriteProperties); 130 131 privs[privWriteContent] = new Privilege("write-content", 132 "Write calendar content", 130 131 privs[privWriteContent] = new Privilege("write-content", 132 "Write calendar content", 133 133 privWriteContent); 134 135 privs[privBind] = new Privilege("create", "Create a calendar object", 134 135 privs[privBind] = new Privilege("create", "Create a calendar object", 136 136 privBind); 137 138 privs[privUnbind] = new Privilege("delete", "Delete a calendar object", 137 138 privs[privUnbind] = new Privilege("delete", "Delete a calendar object", 139 139 privUnbind); 140 141 privs[privUnlock] = new Privilege("unlock", "Remove a lock", 140 141 privs[privUnlock] = new Privilege("unlock", "Remove a lock", 142 142 privUnlock); 143 143 144 144 privs[privNone] = (Privilege)privs[privAll].clone(); 145 145 privs[privNone].setDenial(true); 146 146 147 147 privs[privAll].addContainedPrivilege(privs[privRead]); 148 148 privs[privAll].addContainedPrivilege(privs[privWrite]); 149 149 privs[privAll].addContainedPrivilege(privs[privUnlock]); 150 150 151 151 privs[privRead].addContainedPrivilege(privs[privReadAcl]); 152 152 privs[privRead].addContainedPrivilege(privs[privReadCurrentUserPrivilegeSet]); 153 153 privs[privRead].addContainedPrivilege(privs[privReadFreeBusy]); 154 154 155 155 privs[privWrite].addContainedPrivilege(privs[privWriteAcl]); 156 156 privs[privWrite].addContainedPrivilege(privs[privWriteProperties]); … … 215 215 while (acl.hasMore()) { 216 216 char c = acl.getChar(); 217 if ( c == ' ') {217 if ((c == ' ') || (c == inheritedFlag)) { 218 218 break; 219 219 } … … 239 239 public static void skip(EncodedAcl acl) throws AccessException { 240 240 while (acl.hasMore()) { 241 if (acl.getChar() == ' ') { 241 char c = acl.getChar(); 242 if ((c == ' ') || (c == inheritedFlag)) { 242 243 break; 243 244 } … … 257 258 while (acl.hasMore()) { 258 259 char c = acl.getChar(); 259 if ( c == ' ') {260 if ((c == ' ') || (c == inheritedFlag)) { 260 261 break; 261 262 } trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/AccessUtil.java
r331 r376 121 121 superUser = val; 122 122 } 123 123 124 124 boolean getSuperUser() { 125 125 return superUser; 126 126 } 127 127 128 128 void setAuthUser(BwUser val) { 129 129 authUser = val; … … 164 164 /** Change the access to the given calendar entity using the supplied aces. 165 165 * 166 * @param ent BwShareableDbentity 166 * @param ent BwShareableDbentity 167 167 * @param aces Collection of ace objects 168 168 * @throws CalFacadeException 169 169 */ 170 public void changeAccess(BwShareableDbentity ent, 170 public void changeAccess(BwShareableDbentity ent, 171 171 Collection aces) throws CalFacadeException { 172 172 try { … … 182 182 183 183 ent.setAccess(new String(acl.encode())); 184 185 if (ent instanceof BwCalendar) { 186 updatePathInfo((BwCalendar)ent, acl); 187 } 184 188 } catch (Throwable t) { 185 189 throw new CalFacadeException(t); … … 230 234 CurrentAccess ca; 231 235 String account = ent.getOwner().getAccount(); 232 236 233 237 char[] aclChars = getAclChars(ent); 234 238 … … 243 247 if ((authUser != null) && superUser) { 244 248 // Nobody can stop us - BWAAA HAA HAA 245 ca.accessAllowed = true; 246 } 247 249 ca.accessAllowed = true; 250 } 251 248 252 if (!ca.accessAllowed && !returnResult) { 249 253 throw new CalFacadeAccessException(); … … 359 363 */ 360 364 private PathInfo getPathInfo(BwCalendar cal) throws CalFacadeException { 361 boolean isPublic = cal.getPublick();362 365 Acl acl = null; 363 366 PathInfo pi = new PathInfo(); … … 377 380 if ((aclString == null) && (cal.getCalendar() == null)) { 378 381 // At root 379 if (isPublic) { 380 throw new CalFacadeException("Public calendars must have access set at root"); 381 } 382 383 // XXX temp - set this in /user 384 aclString = access.getDefaultPersonalAccess(); 382 throw new CalFacadeException("Calendars must have default access set at root"); 385 383 } 386 384 … … 398 396 399 397 pi.pathAcl = acl; 400 pi.encoded = acl. getEncoded();398 pi.encoded = acl.encodeAll(); 401 399 402 400 return pi; 401 } catch (CalFacadeException cfe) { 402 throw cfe; 403 } catch (Throwable t) { 404 throw new CalFacadeException(t); 405 } 406 } 407 408 /* Update the merged Acl for the given calendar. 409 */ 410 private void updatePathInfo(BwCalendar cal, Acl acl) throws CalFacadeException { 411 try { 412 String path = cal.getPath(); 413 PathInfo pi = (PathInfo)pathInfoTable.get(path); 414 415 if (pi == null) { 416 pi = new PathInfo(); 417 418 pi.path = cal.getPath(); 419 } 420 421 pi.pathAcl = acl; 422 pi.encoded = acl.encodeAll(); 423 424 pathInfoTable.put(path, pi); 403 425 } catch (Throwable t) { 404 426 throw new CalFacadeException(t); trunk/calendar3/webclient/war/WEB-INF/struts-config.xml
r359 r376 313 313 314 314 <action path="/setAccess" 315 type="org.bedework.webc lient.BwAccessAction"315 type="org.bedework.webcommon.access.AccessAction" 316 316 name="calForm" 317 317 scope="session"
