Changeset 445
- Timestamp:
- 05/04/06 09:34:48
- Files:
-
- trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Ace.java (modified) (6 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) (1 diff)
- 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) (3 diffs)
- trunk/calendar3/appcommon/src/org/bedework/appcommon/AccessAppUtil.java (modified) (1 diff)
- trunk/calendar3/calCore/resources/hbms/AdminGroup.hbm.xml (modified) (1 diff)
- trunk/calendar3/calCore/resources/hbms/Alarm.hbm.xml (modified) (1 diff)
- trunk/calendar3/calCore/resources/hbms/Attendee.hbm.xml (modified) (1 diff)
- trunk/calendar3/calCore/resources/hbms/Calendar.hbm.xml (modified) (3 diffs)
- trunk/calendar3/calCore/resources/hbms/Category.hbm.xml (modified) (1 diff)
- trunk/calendar3/calCore/resources/hbms/Event.hbm.xml (modified) (3 diffs)
- trunk/calendar3/calCore/resources/hbms/EventAnnotation.hbm.xml (modified) (3 diffs)
- trunk/calendar3/calCore/resources/hbms/Filter.hbm.xml (modified) (5 diffs)
- trunk/calendar3/calCore/resources/hbms/Location.hbm.xml (modified) (2 diffs)
- trunk/calendar3/calCore/resources/hbms/Preferences.hbm.xml (modified) (1 diff)
- trunk/calendar3/calCore/resources/hbms/Sponsor.hbm.xml (modified) (2 diffs)
- trunk/calendar3/calCore/resources/hbms/Subscription.hbm.xml (modified) (2 diffs)
- trunk/calendar3/calCore/resources/hbms/System.hbm.xml (modified) (2 diffs)
- trunk/calendar3/calCore/resources/hbms/UserInfo.hbm.xml (modified) (1 diff)
- trunk/calendar3/calCore/resources/hbms/View.hbm.xml (modified) (1 diff)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/AccessUtil.java (modified) (1 diff)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Calendars.java (modified) (7 diffs)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java (modified) (1 diff)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java (modified) (12 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/BwCalendar.java (modified) (7 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/BwSystem.java (modified) (4 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java (modified) (1 diff)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/EventsI.java (modified) (2 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/BwSubscription.java (modified) (2 diffs)
- trunk/calendar3/caldavClientApi/src/org/bedework/caldav/client/CalintfCaldavImpl.java (modified) (1 diff)
- trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java (modified) (5 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/calendars/UpdateCalendarAction.java (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Ace.java
r415 r445 55 55 56 56 import java.io.Serializable; 57 import java.util.ArrayList; 57 58 import java.util.Collection; 58 59 import java.util.Iterator; 59 import java.util.Vector;60 60 61 61 /** Oject to represent an ace for a calendar entity or service. … … 89 89 * @author Mike Douglass douglm@rpi.edu 90 90 */ 91 public class Ace implements Serializable, Comparable {91 public class Ace implements PrivilegeDefs, Serializable, Comparable { 92 92 boolean debug; 93 93 … … 315 315 public Collection getPrivs() { 316 316 if (privs == null) { 317 privs = new Vector();317 privs = new ArrayList(); 318 318 } 319 319 return privs; … … 343 343 } 344 344 345 /** Return an ace which matchesthe name and whoType.345 /** Return the merged privileges for all aces which match the name and whoType. 346 346 * 347 347 * @param acl 348 348 * @param name 349 349 * @param whoType 350 * @return Aceif we find a match else null350 * @return char[] merged privileges if we find a match else null 351 351 * @throws AccessException 352 352 */ 353 public static Ace find(Acl acl, 354 String name, int whoType) throws AccessException { 353 public static char[] findMergedPrivilege(Acl acl, 354 String name, int whoType) throws AccessException { 355 char[] privileges = null; 355 356 Iterator it = acl.getAces().iterator(); 356 357 … … 362 363 (whoType == whoTypeOwner) || 363 364 ace.whoMatch(name))) { 364 return ace; 365 privileges = mergePrivileges(privileges, ace.getHow(), 366 ace.getInherited()); 365 367 } 366 368 } 367 369 368 return null; 370 return privileges; 371 } 372 373 /** If current is null it is set to a cloned copy of morePriv otherwise the 374 * privilege(s) in morePriv are merged into current. 375 * 376 * <p>Specified access overrides inherited access,<br/> 377 * allowed overrides denied overrides unspecified so the order is, from 378 * highest to lowest:<br/> 379 * 380 * allowed, denied, allowedInherited, deniedInherited, unspecified. 381 * 382 * <p>Only allowed and denied appear in encoded aces. 383 * 384 * @param current 385 * @param morePriv 386 * @param inherited true if the ace was an inherited ace 387 * @return char[] mergedPrivileges 388 */ 389 public static char[] mergePrivileges(char[] current, char[] morePriv, 390 boolean inherited) { 391 char[] mp = (char[])morePriv.clone(); 392 393 if (inherited) { 394 for (int i = 0; i <= privMaxType; i++) { 395 char p = mp[i]; 396 if (p == allowed) { 397 mp[i] = allowedInherited; 398 } else if (p == denied) { 399 mp[i] = deniedInherited; 400 } 401 } 402 } 403 if (current == null) { 404 return mp; 405 } 406 407 for (int i = 0; i <= privMaxType; i++) { 408 if (current[i] < mp[i]) { 409 current[i] = mp[i]; 410 } 411 } 412 413 return current; 369 414 } 370 415 … … 662 707 } 663 708 } 664 /* 665 if (c == whoFlagOwner) { 666 whoType = whoTypeOwner; 667 } else if (c == whoFlagUser) { 668 whoType = whoTypeUser; 669 } else if (c == whoFlagGroup) { 670 whoType = whoTypeGroup; 671 } else if (c == whoFlagHost) { 672 whoType = whoTypeHost; 673 } else if (c == whoFlagOther) { 674 whoType = whoTypeOther; 675 } else if (c == whoFlagUnauthenticated) { 676 whoType = whoTypeUnauthenticated; 677 } else if (c == whoFlagUnauthenticated) { 678 whoType = whoTypeUnauthenticated; 679 } else { 680 */ 709 681 710 throw AccessException.badACE("who type"); 682 711 } trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Acl.java
r336 r445 88 88 89 89 /** Used while evaluating access */ 90 // private Ace ace = new Ace();91 90 92 91 /** Constructor … … 119 118 aces = null; 120 119 } 121 120 122 121 /** Result of evaluating access to an object for a principal 123 122 */ 124 123 public static class CurrentAccess { 125 /** The Acl used to evaluate the access. We should not necessarily 124 /** The Acl used to evaluate the access. We should not necessarily 126 125 * make this available to the client. 127 126 */ 128 127 public Acl acl; 129 130 /** Allowed access for each privilege type 128 129 /** Allowed access for each privilege type 131 130 * @see PrivilegeDefs 132 131 */ … … 138 137 /** Was it succesful */ 139 138 public boolean accessAllowed; 140 139 141 140 public String toString() { 142 141 StringBuffer sb = new StringBuffer("CurrentAccess{"); 143 142 sb.append("acl="); 144 143 sb.append(acl); 145 144 146 145 sb.append("accessAllowed="); 147 146 sb.append(accessAllowed); … … 166 165 * <li>If the principal is the owner then use the given access or the default.</li> 167 166 * 168 * <li>If there is a specific ACE for the user use that. </li>167 * <li>If there are specific ACEs for the user use the merged access. </li> 169 168 * 170 169 * <li>Find all group entries for the given user's groups. If there is more than … … 196 195 ca.acl = this; 197 196 198 /* 199 setEncoded(acl); 197 decode(acl); 200 198 201 199 if (authenticated) { … … 216 214 getPrivileges: { 217 215 if (!authenticated) { 218 if (ace.decode(this, false, null, Ace.whoTypeUnauthenticated)) { 219 ca.privileges = ace.getHow(); 220 } 216 ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeUnauthenticated); 221 217 222 218 break getPrivileges; … … 224 220 225 221 if (isOwner) { 226 if (ace.decode(this, false, null, Ace.whoTypeOwner)) { 227 ca.privileges = ace.getHow(); 228 } else { 222 ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeOwner); 223 if (ca.privileges == null) { 229 224 ca.privileges = defaultOwnerPrivileges; 230 225 } … … 234 229 235 230 // Not owner - look for user 236 if (ace.decode(this, false, who.getAccount(), Ace.whoTypeUser)) {237 ca.privileges = ace.getHow();231 ca.privileges = Ace.findMergedPrivilege(this, who.getAccount(), Ace.whoTypeUser); 232 if (ca.privileges != null) { 238 233 if (debug) { 239 234 debugsb.append("... For user got: " + new String(ca.privileges)); … … 253 248 debugsb.append("...Try access for group " + group); 254 249 } 255 if (ace.decode(this, false, group, Ace.whoTypeGroup)) { 256 ca.privileges = mergePrivileges(ca.privileges, ace.getHow()); 250 char[] privs = Ace.findMergedPrivilege(this, group, Ace.whoTypeGroup); 251 if (privs != null) { 252 ca.privileges = Ace.mergePrivileges(ca.privileges, privs, false); 257 253 } 258 254 } … … 268 264 269 265 // "other" access set? 270 if (ace.decode(this, false, null, Ace.whoTypeOther)) { 271 ca.privileges = ace.getHow(); 272 273 if (debug) { 274 debugsb.append("...For other got: " + new String(ca.privileges)); 275 } 276 277 break getPrivileges; 278 } 279 } // getPrivileges 280 */ 281 decode(acl); 282 283 if (authenticated) { 284 isOwner = who.getAccount().equals(owner); 285 } 286 287 StringBuffer debugsb = null; 288 289 if (debug) { 290 debugsb = new StringBuffer("Check access for '"); 291 debugsb.append(new String(acl)); 292 debugsb.append("' with authenticated = "); 293 debugsb.append(authenticated); 294 debugsb.append(" isOwner = "); 295 debugsb.append(isOwner); 296 } 297 298 Ace ace; 299 300 getPrivileges: { 301 if (!authenticated) { 302 ace = Ace.find(this, null, Ace.whoTypeUnauthenticated); 303 if (ace != null) { 304 ca.privileges = ace.getHow(); 305 } 306 307 break getPrivileges; 308 } 309 310 if (isOwner) { 311 ace = Ace.find(this, null, Ace.whoTypeOwner); 312 if (ace != null) { 313 ca.privileges = ace.getHow(); 314 } else { 315 ca.privileges = defaultOwnerPrivileges; 316 } 317 318 break getPrivileges; 319 } 320 321 // Not owner - look for user 322 ace = Ace.find(this, who.getAccount(), Ace.whoTypeUser); 323 if (ace != null) { 324 ca.privileges = ace.getHow(); 325 if (debug) { 326 debugsb.append("... For user got: " + new String(ca.privileges)); 327 } 328 329 break getPrivileges; 330 } 331 332 // No specific user access - look for group access 333 334 if (who.getGroupNames() != null) { 335 Iterator it = who.getGroupNames().iterator(); 336 337 while (it.hasNext()) { 338 String group = (String)it.next(); 339 if (debug) { 340 debugsb.append("...Try access for group " + group); 341 } 342 ace = Ace.find(this, group, Ace.whoTypeGroup); 343 if (ace != null) { 344 ca.privileges = mergePrivileges(ca.privileges, ace.getHow()); 345 } 346 } 347 } 348 266 ca.privileges = Ace.findMergedPrivilege(this, null, Ace.whoTypeOther); 349 267 if (ca.privileges != null) { 350 if (debug) {351 debugsb.append("...For groups got: " + new String(ca.privileges));352 }353 354 break getPrivileges;355 }356 357 // "other" access set?358 ace = Ace.find(this, null, Ace.whoTypeOther);359 if (ace != null) {360 ca.privileges = ace.getHow();361 362 268 if (debug) { 363 269 debugsb.append("...For other got: " + new String(ca.privileges)); … … 385 291 } 386 292 } 387 293 388 294 for (int i = 0; i < how.length; i++) { 389 295 char priv = ca.privileges[how[i].getIndex()]; 390 296 391 if ( priv != allowed) {297 if ((priv != allowed) && (priv != allowedInherited)) { 392 298 if (debug) { 393 299 debugMsg(debugsb.toString() + "...Check access denied (!allowed)"); … … 403 309 ca.accessAllowed = true; 404 310 return ca; 405 }406 407 private char[] mergePrivileges(char[] current, char[] morePriv) {408 if (current == null) {409 return morePriv;410 }411 412 for (int i = 0; i <= privMaxType; i++) {413 if (current[i] < morePriv[i]) {414 current[i] = morePriv[i];415 }416 }417 418 return current;419 311 } 420 312 trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Privilege.java
r331 r445 222 222 223 223 /* Expect the privilege allowed/denied flag 224 * (or the oldDenied or oldAllowed flag) 224 225 */ 225 if ( c == denied) {226 if ((c == denied) || (c == oldDenied)) { 226 227 denial = true; 227 } else if ( c == allowed) {228 } else if ((c == allowed) || (c == oldAllowed)) { 228 229 denial = false; 229 230 } else { trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/PrivilegeDefs.java
r415 r445 61 61 */ 62 62 public interface PrivilegeDefs extends Serializable { 63 /* old allowed and old denied allow us to respecify the flags allowing for 64 * inherited access 65 */ 66 /** Old allowed flag - appears in old acls being converted to new form 67 */ 68 public static final char oldAllowed = '3'; 69 70 /** Old denied privilege. 71 */ 72 public static final char oldDenied = '2'; 73 74 /* The following flags must sort with values in the order: 75 * allowed, denied, allowedInherited, deniedInherited, unspecified. 76 */ 77 78 /** Allowed flag - appears in acls 79 */ 80 public static final char allowed = 'y'; 81 63 82 /** A denied privilege is a privilege, e.g. read which is denied to the 64 associated 'who'. The following must have the order:<br/> 65 unspecified - denied - allowed<br/> 66 from least to most. 67 */ 68 public static final char allowed = '3'; 69 70 /** Denied access 71 */ 72 public static final char denied = '2'; 83 associated 'who' - appears in ace. 84 */ 85 public static final char denied = 'n'; 73 86 74 87 /** This only appears in the final result from Privileges.fromEncoding 75 88 */ 76 public static final char unspecified = '1'; 77 78 /** Shows an ace was inherited 89 public static final char allowedInherited = 'Y'; 90 91 /** This only appears in the final result from Privileges.fromEncoding 92 */ 93 public static final char deniedInherited = 'N'; 94 95 /** This only appears in the final result from Privileges.fromEncoding 96 */ 97 public static final char unspecified = '?'; 98 99 /** Shows an ace was inherited - appears in ace 79 100 */ 80 101 public static final char inheritedFlag = 'I'; trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Privileges.java
r376 r445 54 54 package edu.rpi.cct.uwcal.access; 55 55 56 import java.util.ArrayList; 56 57 import java.util.Collection; 57 58 import java.util.Iterator; 58 import java.util.Vector;59 59 60 60 /** Define the privileges we recognize for the calendar. … … 254 254 */ 255 255 public static Collection getPrivs(EncodedAcl acl) throws AccessException { 256 Vector v = new Vector();256 ArrayList al = new ArrayList(); 257 257 258 258 while (acl.hasMore()) { … … 268 268 } 269 269 270 v.add(p);271 } 272 273 return v;270 al.add(p); 271 } 272 273 return al; 274 274 } 275 275 trunk/calendar3/appcommon/src/org/bedework/appcommon/AccessAppUtil.java
r415 r445 233 233 234 234 for (int pi = 0; pi < privileges.length; pi++) { 235 if (privileges[pi] == PrivilegeDefs.allowed) { 235 if ((privileges[pi] == PrivilegeDefs.allowed) || 236 (privileges[pi] == PrivilegeDefs.allowedInherited)) { 236 237 // XXX further work - don't emit abstract privs or contained privs. 237 238 QName pr = privTags[pi]; trunk/calendar3/calCore/resources/hbms/AdminGroup.hbm.xml
r309 r445 17 17 <version name="seq" column="seq" type="integer" /> 18 18 19 <property name="account" column=" name" type="text"/>19 <property name="account" column="account" type="text"/> 20 20 21 21 <!-- trunk/calendar3/calCore/resources/hbms/Alarm.hbm.xml
r235 r445 58 58 </discriminator> 59 59 60 <version name="seq" column=" sequence" type="integer" />60 <version name="seq" column="bwsequence" type="integer" /> 61 61 62 62 <property name="alarmType" column="alarm_type" type="integer" /> trunk/calendar3/calCore/resources/hbms/Attendee.hbm.xml
r2 r445 15 15 </id> 16 16 17 <version name="seq" column=" sequence" type="integer" />17 <version name="seq" column="bwsequence" type="integer" /> 18 18 19 19 <property name="cn" type="text"/> trunk/calendar3/calCore/resources/hbms/Calendar.hbm.xml
r436 r445 31 31 </many-to-one> 32 32 33 <property name="access" column=" access" type="text" />33 <property name="access" column="bwaccess" type="text" /> 34 34 35 35 <property name="publick" type="true_false" > … … 37 37 </property> 38 38 39 <property name="name" column=" name" type="text" not-null="true"/>39 <property name="name" column="calname" type="text" not-null="true"/> 40 40 41 41 <!-- I wanted to specify unique="true" on this but mysql complains. … … 57 57 58 58 <set name="children" inverse="true" cascade="all-delete-orphan" 59 order-by=" name" >59 order-by="calname" > 60 60 <cache usage="read-write"/> 61 61 <key column="parent" /> 62 62 <one-to-many class="org.bedework.calfacade.BwCalendar" /> 63 63 </set> 64 65 <property name="calType" column="caltype" type="integer" not-null="true"/> 64 66 </class> 65 67 trunk/calendar3/calCore/resources/hbms/Category.hbm.xml
r176 r445 32 32 </many-to-one> 33 33 34 <property name="access" column=" access" type="text" />34 <property name="access" column="bwaccess" type="text" /> 35 35 36 36 <property name="publick" type="true_false" > trunk/calendar3/calCore/resources/hbms/Event.hbm.xml
r246 r445 29 29 </many-to-one> 30 30 31 <property name="access" column=" access" type="text" />31 <property name="access" column="bwaccess" type="text" /> 32 32 33 33 <property name="publick" type="true_false" > … … 73 73 <property name="description" column="description" type="text"/> 74 74 75 <property name="link" column=" link" type="string" />75 <property name="link" column="bwlink" type="string" /> 76 76 77 77 <property name="status" type="string" /> … … 122 122 <property name="guid" type="string" length="500" unique-key="event-key" /> 123 123 124 <property name="sequence" type="integer" />124 <property name="sequence" column="rfcsequence" type="integer" /> 125 125 126 126 <property name="transparency" column="transparency" type="text"/> trunk/calendar3/calCore/resources/hbms/EventAnnotation.hbm.xml
r441 r445 35 35 </many-to-one> 36 36 37 <property name="access" column=" access" type="text" />37 <property name="access" column="bwaccess" type="text" /> 38 38 39 39 <property name="publick" type="true_false" > … … 78 78 <property name="description" column="description" type="text"/> 79 79 80 <property name="link" column=" link" type="string" />80 <property name="link" column="bwlink" type="string" /> 81 81 82 82 <property name="status" type="string" /> … … 123 123 <property name="guid" type="string" length="500" unique-key="eventann-key" /> 124 124 125 <property name="sequence" type="integer" />125 <property name="sequence" column="rfcsequence" type="integer" /> 126 126 127 127 <property name="transparency" column="transparency" type="text"/> trunk/calendar3/calCore/resources/hbms/Filter.hbm.xml
r2 r445 36 36 37 37 <property name="name" type="string" > 38 <column name=" name" length="200" />38 <column name="filtername" length="200" /> 39 39 </property> 40 40 … … 110 110 discriminator-value="A" > 111 111 <set name="children" inverse="true" cascade="all-delete-orphan" 112 order-by=" name" >112 order-by="filtername" > 113 113 <key column="parent" /> 114 114 <one-to-many class="org.bedework.calfacade.filter.BwFilter" /> … … 119 119 discriminator-value="O" > 120 120 <set name="children" inverse="true" cascade="all-delete-orphan" 121 order-by=" name" >121 order-by="filtername" > 122 122 <key column="parent" /> 123 123 <one-to-many class="org.bedework.calfacade.filter.BwFilter" /> … … 192 192 discriminator-value="A" > 193 193 <set name="children" inverse="true" cascade="all-delete-orphan" 194 order-by=" name" >194 order-by="filtername" > 195 195 <key column="parent" /> 196 196 <one-to-many class="org.bedework.calfacade.filter.BwFilter" /> … … 201 201 discriminator-value="O" > 202 202 <set name="children" inverse="true" cascade="all-delete-orphan" 203 order-by=" name" >203 order-by="filtername" > 204 204 <key column="parent" /> 205 205 <one-to-many class="org.bedework.calfacade.filter.BwFilter" /> trunk/calendar3/calCore/resources/hbms/Location.hbm.xml
r176 r445 32 32 </many-to-one> 33 33 34 <property name="access" column=" access" type="text" />34 <property name="access" column="bwaccess" type="text" /> 35 35 36 36 <property name="publick" type="true_false" > … … 42 42 </property> 43 43 <property name="subaddress" column="subaddress" type="string"/> 44 <property name="link" column=" link" type="string"/>44 <property name="link" column="bwlink" type="string"/> 45 45 </class> 46 46 trunk/calendar3/calCore/resources/hbms/Preferences.hbm.xml
r86 r445 55 55 <property name="workdayEnd" column="workday_end" type="integer" /> 56 56 <property name="preferredEndType" column="preferred_endtype" type="string" /> 57 58 <property name="userMode" column="bwuser_mode" type="integer" /> 57 59 </class> 58 60 trunk/calendar3/calCore/resources/hbms/Sponsor.hbm.xml
r176 r445 32 32 </many-to-one> 33 33 34 <property name="access" column=" access" type="text" />34 <property name="access" column="bwaccess" type="text" /> 35 35 36 36 <property name="publick" type="true_false" > … … 39 39 40 40 <property name="name" type="string" > 41 <column name=" name" not-null="true" unique-key="sponsor_key" />41 <column name="sponsorname" not-null="true" unique-key="sponsor_key" /> 42 42 </property> 43 43 <property name="phone" column="phone" type="string"/> 44 44 <property name="email" column="email" type="string"/> 45 <property name="link" column=" link" type="string"/>45 <property name="link" column="bwlink" type="string"/> 46 46 </class> 47 47 trunk/calendar3/calCore/resources/hbms/Subscription.hbm.xml
r54 r445 18 18 <version name="seq" column="seq" type="integer" /> 19 19 20 <property name="name" column=" name" type="text" not-null="true"/>20 <property name="name" column="subscrname" type="text" not-null="true"/> 21 21 22 22 <many-to-one name="owner" … … 29 29 <property name="affectsFreeBusy" type="true_false" 30 30 column="affects_free_busy" not-null="true" /> 31 32 <property name="ignoreTransparency" type="true_false" 33 column="ignore_transparency" not-null="true" /> 31 34 32 35 <property name="display" type="true_false" trunk/calendar3/calCore/resources/hbms/System.hbm.xml
r64 r445 18 18 <version name="seq" column="seq" type="integer" /> 19 19 20 <property name="name" column=" name" type="text" />20 <property name="name" column="bwname" type="text" /> 21 21 <property name="tzid" column="tzid" type="text" /> 22 22 <property name="systemid" column="systemid" type="text" /> … … 27 27 <property name="userInbox" column="userInbox" type="text" /> 28 28 <property name="userOutbox" column="userOutbox" type="text" /> 29 <property name="deletedCalendar" column="deletedCalendar" type="text" /> 30 <property name="busyCalendar" column="busyCalendar" type="text" /> 29 31 <property name="defaultUserViewName" column="defaultUserViewName" type="text" /> 30 32 trunk/calendar3/calCore/resources/hbms/UserInfo.hbm.xml
r2 r445 32 32 <property name="dept" column="department" type="string"/> 33 33 34 <set name="properties" order-by="name asc"> 34 <set name="properties" 35 table="bwuser_properties" order-by="name asc"> 35 36 <key column="user_info" /> 36 37 <composite-element class="org.bedework.calfacade.BwUserInfo$UserProperty"> 37 <property name="name" column=" name" not-null="true"/>38 <property name="name" column="propname" not-null="true"/> 38 39 <property name="val" column="val" /> 39 40 </composite-element> trunk/calendar3/calCore/resources/hbms/View.hbm.xml
r2 r445 17 17 <version name="seq" column="seq" type="integer" /> 18 18 19 <property name="name" column=" name" type="text" not-null="true"/>19 <property name="name" column="viewname" type="text" not-null="true"/> 20 20 21 21 <many-to-one name="owner" trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/AccessUtil.java
r376 r445 231 231 } 232 232 233 // XXX 234 // XXX 235 // XXX 236 // XXX 237 /* We need to special case the access to the user root e.g /user and 238 * the 'home' directory, e.g. /user/douglm 239 * 240 * We deny access to /user to anybody without superuser access. This 241 * prevents user browsing. 242 * 243 * Default access to the home directory is read, write-content to the owner 244 * only and unlimited to superuser. 245 * 246 * Specific access should be no more than read, write-content to the home 247 * directory. 248 */ 249 233 250 try { 234 251 CurrentAccess ca; trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Calendars.java
r436 r445 143 143 cal.setCalendar(usercal); 144 144 cal.setCalendarCollection(true); 145 cal.setCalType(BwCalendar.calTypeCollection); 145 146 usercal.addChild(cal); 146 147 … … 154 155 cal.setCalendar(usercal); 155 156 cal.setCalendarCollection(true); 157 cal.setCalType(BwCalendar.calTypeTrash); 156 158 usercal.addChild(cal); 157 159 … … 165 167 cal.setCalendar(usercal); 166 168 cal.setCalendarCollection(true); 169 cal.setCalType(BwCalendar.calTypeInbox); 167 170 usercal.addChild(cal); 168 171 … … 176 179 cal.setCalendar(usercal); 177 180 cal.setCalendarCollection(true); 181 cal.setCalType(BwCalendar.calTypeOutbox); 178 182 usercal.addChild(cal); 179 183 180 184 /* Add the deleted calendar */ 181 185 cal = new BwCalendar(); 182 // XXX new syspar cal.setName(getSyspars().getUserOutbox()); 183 cal.setName("Deleted"); 186 cal.setName(getSyspars().getDeletedCalendar()); 184 187 cal.setCreator(user); 185 188 cal.setOwner(user); 186 189 cal.setPublick(false); 187 // XXX new syspar cal.setPath(path + "/" + getSyspars().getUserOutbox()); 188 cal.setPath(path + "/" + "Deleted"); 190 cal.setPath(path + "/" + getSyspars().getDeletedCalendar()); 189 191 cal.setCalendar(usercal); 190 192 cal.setCalendarCollection(true); 193 cal.setCalType(BwCalendar.calTypeDeleted); 194 usercal.addChild(cal); 195 196 /* Add the busy calendar */ 197 cal = new BwCalendar(); 198 cal.setName(getSyspars().getBusyCalendar()); 199 cal.setCreator(user); 200 cal.setOwner(user); 201 cal.setPublick(false); 202 cal.setPath(path + "/" + getSyspars().getBusyCalendar()); 203 cal.setCalendar(usercal); 204 cal.setCalendarCollection(true); 205 cal.setCalType(BwCalendar.calTypeBusy); 191 206 usercal.addChild(cal); 192 207 … … 380 395 381 396 BwCalendar cal = new BwCalendar(); 382 cal.setName("Deleted"); 383 cal.setOwner(user); 384 cal.setCreator(user); 385 cal.setCalendarCollection(true); 397 cal.setName(getSyspars().getDeletedCalendar()); 398 cal.setOwner(user); 399 cal.setCreator(user); 400 cal.setCalendarCollection(true); 401 cal.setCalType(BwCalendar.calTypeDeleted); 386 402 addCalendar(cal, pathTo); 387 403 } … … 424 440 val.setCalendar(parent); 425 441 val.setPublick(parent.getPublick()); 442 if (val.getCalendarCollection()) { 443 val.setCalType(BwCalendar.calTypeCollection); 444 } else { 445 val.setCalType(BwCalendar.calTypeFolder); 446 } 426 447 parent.addChild(val); 427 448 … … 443 464 /* Objects are probably clones - fetch the real ones. 444 465 */ 445 parent = getCalendar(parent.getPath(), privRead );466 parent = getCalendar(parent.getPath(), privRead, false); 446 467 if (parent == null) { 447 468 throw new CalFacadeException(CalFacadeException.cannotDeleteCalendarRoot); 448 469 } 449 470 450 val = getCalendar(val.getPath(), privUnbind );471 val = getCalendar(val.getPath(), privUnbind, false); 451 472 if (val == null) { 452 473 throw new CalFacadeException(CalFacadeException.calendarNotFound); trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/CalintfImpl.java
r436 r445 1075 1075 BwDateTime startDate, BwDateTime endDate, 1076 1076 int recurRetrieval, 1077 boolean freeBusy) throws CalFacadeException { 1077 boolean freeBusy, 1078 boolean allCalendars) throws CalFacadeException { 1078 1079 return events.getEvents(calendar, filter, 1079 1080 startDate, endDate, recurRetrieval, 1080 freeBusy );1081 freeBusy, allCalendars); 1081 1082 } 1082 1083 trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Events.java
r441 r445 585 585 BwDateTime startDate, BwDateTime endDate, 586 586 int recurRetrieval, 587 boolean freeBusy) throws CalFacadeException { 587 boolean freeBusy, 588 boolean allCalendars) throws CalFacadeException { 588 589 HibSession sess = getSess(); 589 590 StringBuffer sb = new StringBuffer(); … … 629 630 630 631 boolean setUser = doCalendarClause(sb, qevName, calendar, 631 currentMode, cal.getSuperUser()); 632 currentMode, cal.getSuperUser(), 633 allCalendars); 632 634 633 635 sb.append(") "); … … 662 664 //} 663 665 664 doCalendarEntities(setUser, calendar );666 doCalendarEntities(setUser, calendar, allCalendars); 665 667 666 668 flt.parPass(sess); … … 689 691 Collection rceis = getLimitedRecurrences(calendar, filter, startDate, endDate, 690 692 currentMode, cal.getSuperUser(), 691 recurRetrieval, freeBusy); 693 recurRetrieval, freeBusy, 694 allCalendars); 692 695 if (rceis != null) { 693 696 ceis.addAll(rceis); … … 893 896 int currentMode, boolean ignoreCreator, 894 897 int recurRetrieval, 895 boolean freeBusy) 898 boolean freeBusy, 899 boolean allCalendars) 896 900 throws CalFacadeException { 897 901 HibSession sess = getSess(); … … 925 929 926 930 boolean setUser = doCalendarClause(sb, qevName + ".master", calendar, 927 currentMode, ignoreCreator); 931 currentMode, ignoreCreator, 932 allCalendars); 928 933 929 934 sb.append(") "); … … 949 954 } 950 955 951 doCalendarEntities(setUser, calendar );956 doCalendarEntities(setUser, calendar, allCalendars); 952 957 953 958 flt.parPass(sess); … … 1002 1007 */ 1003 1008 private boolean doCalendarClause(StringBuffer sb, String qevName, BwCalendar calendar, 1004 int currentMode, boolean ignoreCreator) throws CalFacadeException { 1009 int currentMode, boolean ignoreCreator, 1010 boolean allCalendars) throws CalFacadeException { 1005 1011 /* if no calendar set 1006 1012 if public … … 1015 1021 1016 1022 if (calendar.getCalendarCollection()) { 1017 // Single leaf calendar 1023 // Single leaf calendar - always include 1018 1024 sb.append("("); 1019 1025 sb.append(qevName); … … 1025 1031 // Non leaf - build a query 1026 1032 sb.append("("); 1027 appendCalendarClause(sb, qevName, calendar, new CalTerm() );1033 appendCalendarClause(sb, qevName, calendar, new CalTerm(), allCalendars); 1028 1034 sb.append(") "); 1029 1035 … … 1032 1038 1033 1039 private void appendCalendarClause(StringBuffer sb, String qevName, BwCalendar calendar, 1034 CalTerm calTerm) throws CalFacadeException { 1040 CalTerm calTerm, 1041 boolean allCalendars) throws CalFacadeException { 1035 1042 if (calendar.getCalendarCollection()) { 1036 // leaf calendar 1037 if (calTerm.i > 1) { 1038 sb.append(" or "); 1039 } 1040 sb.append(qevName); 1041 sb.append(".calendar=:calendar" + calTerm.i); 1042 calTerm.i++; 1043 if (allCalendars || (calendar.getCalType() == BwCalendar.calTypeCollection)) { 1044 // leaf calendar 1045 if (calTerm.i > 1) { 1046 sb.append(" or "); 1047 } 1048 sb.append(qevName); 1049 sb.append(".calendar=:calendar" + calTerm.i); 1050 calTerm.i++; 1051 } 1043 1052 } else { 1044 1053 Iterator it = calendar.getChildren().iterator(); 1045 1054 while (it.hasNext()) { 1046 appendCalendarClause(sb, qevName, (BwCalendar)it.next(), calTerm); 1047 } 1048 } 1049 } 1050 1051 private void doCalendarEntities(boolean setUser, BwCalendar calendar) 1055 appendCalendarClause(sb, qevName, (BwCalendar)it.next(), calTerm, 1056 allCalendars); 1057 } 1058 } 1059 } 1060 1061 private void doCalendarEntities(boolean setUser, BwCalendar calendar, 1062 boolean allCalendars) 1052 1063 throws CalFacadeException { 1053 1064 HibSession sess = getSess(); … … 1058 1069 if (calendar != null) { 1059 1070 if (calendar.getCalendarCollection()) { 1060 // Single leaf calendar 1071 // Single leaf calendar - always include 1061 1072 sess.setEntity("calendar", calendar); 1062 1073 } else { 1063 1074 // Non leaf - add entities 1064 setCalendarEntities(calendar, new CalTerm()); 1065 } 1066 } 1067 } 1068 1069 private void setCalendarEntities(BwCalendar calendar, CalTerm calTerm) 1075 setCalendarEntities(calendar, new CalTerm(), allCalendars); 1076 } 1077 } 1078 } 1079 1080 private void setCalendarEntities(BwCalendar calendar, CalTerm calTerm, 1081 boolean allCalendars) 1070 1082 throws CalFacadeException { 1071 1083 if (calendar.getCalendarCollection()) { 1072 // leaf calendar 1073 getSess().setEntity("calendar" + calTerm.i, calendar); 1074 calTerm.i++; 1084 if (allCalendars || (calendar.getCalType() == BwCalendar.calTypeCollection)) { 1085 // leaf calendar 1086 getSess().setEntity("calendar" + calTerm.i, calendar); 1087 calTerm.i++; 1088 } 1075 1089 } else { 1076 1090 Iterator it = calendar.getChildren().iterator(); 1077 1091 while (it.hasNext()) { 1078 setCalendarEntities((BwCalendar)it.next(), calTerm );1092 setCalendarEntities((BwCalendar)it.next(), calTerm, allCalendars); 1079 1093 } 1080 1094 } trunk/calendar3/calFacade/src/org/bedework/calfacade/BwCalendar.java
r415 r445 103 103 private Collection children; 104 104 105 /* The type of calendar */ 106 // ENUM 107 private int calType; 108 109 /** Normal folder */ 110 public final static int calTypeFolder = 0; 111 112 /** Normal calendar collection */ 113 public final static int calTypeCollection = 1; 114 115 /** Trash */ 116 public final static int calTypeTrash = 2; 117 118 /** Deleted */ 119 public final static int calTypeDeleted = 3; 120 121 /** Busy */ 122 public final static int calTypeBusy = 4; 123 124 /** Inbox */ 125 public final static int calTypeInbox = 5; 126 127 /** Outbox */ 128 public final static int calTypeOutbox = 6; 129 105 130 /* This field must only be used for cloned copies of an entity as it is 106 131 * specific to a current thread. … … 128 153 * @param parent 129 154 * @param children 155 * @param calType 130 156 */ 131 157 public BwCalendar(BwUser owner, … … 140 166 boolean calendarCollection, 141 167 BwCalendar parent, 142 Collection children) { 168 Collection children, 169 int calType) { 143 170 super(owner, publick, creator, access); 144 171 this.name = name; … … 150 177 setCalendar(parent); 151 178 this.children = children; 179 this.calType = calType; 152 180 } 153 181 … … 268 296 } 269 297 return children; 298 } 299 300 /** Set the type 301 * 302 * @param val type 303 */ 304 public void setCalType(int val) { 305 calType = val; 306 } 307 308 /** Get the description 309 * 310 * @return String description 311 */ 312 public int getCalType() { 313 return calType; 270 314 } 271 315 … … 382 426 getCalendarCollection(), 383 427 getCalendar(), 384 null); 428 null, 429 getCalType()); 385 430 } 386 431 … … 470 515 getCalendarCollection(), 471 516 getCalendar(), 472 getChildren()); 517 getChildren(), 518 getCalType()); 473 519 } 474 520 } trunk/calendar3/calFacade/src/org/bedework/calfacade/BwSystem.java
r418 r445 82 82 private String userInbox; 83 83 private String userOutbox; 84 private String deletedCalendar; 85 private String busyCalendar; 84 86 private String defaultUserViewName; 85 87 … … 215 217 } 216 218 217 /** Set the user inbox 219 /** Set the user inbox name 218 220 * 219 221 * @param val String … … 223 225 } 224 226 225 /** Get the user Calendar227 /** Get the user inbox name 226 228 * 227 229 * @return String user inbox … … 245 247 public String getUserOutbox() { 246 248 return userOutbox; 249 } 250 251 /** Set the user deleted calendar name 252 * 253 * @param val String 254 */ 255 public void setDeletedCalendar(String val) { 256 deletedCalendar = val; 257 } 258 259 /** Get the user deleted calendar name 260 * 261 * @return String user deleted calendar name 262 */ 263 public String getDeletedCalendar() { 264 return deletedCalendar; 265 } 266 267 /** Set the user busy calendar name 268 * 269 * @param val String 270 */ 271 public void setBusyCalendar(String val) { 272 busyCalendar = val; 273 } 274 275 /** Get the user busy calendar name 276 * 277 * @return String user busy calendar name 278 */ 279 public String getBusyCalendar() { 280 return busyCalendar; 247 281 } 248 282 trunk/calendar3/calFacade/src/org/bedework/calfacade/base/CalintfBase.java
r436 r445 714 714 BwDateTime startDate, BwDateTime endDate, 715 715 int recurRetrieval, 716 boolean freeBusy) throws CalFacadeException { 716 boolean freeBusy, 717 boolean allCalendars) throws CalFacadeException { 717 718 throw new CalFacadeUnimplementedException(); 718 719 } trunk/calendar3/calFacade/src/org/bedework/calfacade/ifs/EventsI.java
r415 r445 130 130 * @param freeBusy Return skeleton events with date/times and skip 131 131 * transparent events. 132 * @param allCalendars False - ignore any 'special' calendars. 132 133 * @return Collection of CoreEventInfo objects 133 134 * @throws CalFacadeException … … 136 137 BwDateTime startDate, BwDateTime endDate, 137 138 int recurRetrieval, 138 boolean freeBusy) throws CalFacadeException; 139 boolean freeBusy, 140 boolean allCalendars) throws CalFacadeException; 139 141 140 142 /** XXX temp I think trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/BwSubscription.java
r253 r445 58 58 private boolean affectsFreeBusy; 59 59 60 /** Ignore the transparency setting? 61 */ 62 private boolean ignoreTransparency; 63 60 64 /** Should this subscription be displayed by default? 61 65 */ … … 145 149 public boolean getAffectsFreeBusy() { 146 150 return affectsFreeBusy; 151 } 152 153 /** Set the ignoreTransparency flag 154 * 155 * @param val true if the subscription takes part in free/busy calculations 156 */ 157 public void setIgnoreTransparency(boolean val) { 158 ignoreTransparency = val; 159 } 160 161 /** Do we ignore transparency? 162 * 163 * @return boolean true for ignoreTransparency 164 */ 165 public boolean getIgnoreTransparency() { 166 return ignoreTransparency; 147 167 } 148 168 trunk/calendar3/caldavClientApi/src/org/bedework/caldav/client/CalintfCaldavImpl.java
r436 r445 598 598 BwDateTime startDate, BwDateTime endDate, 599 599 int recurRetrieval, 600 boolean freeBusy) throws CalFacadeException { 600 boolean freeBusy, 601 boolean allCalendars) throws CalFacadeException { 601 602 throw new CalFacadeUnimplementedException(); 602 603 } trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java
r439 r445 1078 1078 BwEvent ev = ei.getEvent(); 1079 1079 1080 // XXX Need to add sub.ignoreTransparency 1081 if (BwEvent.transparencyTransparent.equals(ev.getTransparency())) { 1080 if (!sub.getIgnoreTransparency() && 1081 BwEvent.transparencyTransparent.equals(ev.getTransparency())) { 1082 // Ignore this one. 1082 1083 continue; 1083 1084 } … … 1902 1903 TreeSet ts = new TreeSet(); 1903 1904 1904 // if (pars.getPublicAdmin() || (sub != null)) {1905 1905 if (sub != null) { 1906 BwCalendar cal = null; 1907 if (sub != null) { 1908 cal = sub.getCalendar(); 1909 } 1910 return postProcess(getCal().getEvents(cal, filter, startDate, 1906 // Explicitly selected calendar - via a subscription. 1907 1908 return postProcess(getCal().getEvents(sub.getCalendar(), filter, startDate, 1911 1909 endDate, recurRetrieval, 1912 freeBusy ),1910 freeBusy, true), 1913 1911 sub); 1914 1912 } 1915 1913 1916 1914 Collection subs = null; 1915 1916 /* Through a view or the complete set of subscriptions. Do not include 1917 * 'special' calendars. 1918 */ 1917 1919 1918 1920 if (currentView != null) { … … 1947 1949 return postProcess(getCal().getEvents(null, filter, startDate, 1948 1950 endDate, recurRetrieval, 1949 freeBusy ),1951 freeBusy, false), 1950 1952 sub); 1951 1953 } … … 1988 1990 ts.addAll(postProcess(getCal().getEvents(internal, filter, 1989 1991 startDate, endDate, 1990 recurRetrieval, freeBusy ),1992 recurRetrieval, freeBusy, false), 1991 1993 sublookup)); 1992 1994 … … 2265 2267 prefs.setDefaultCalendar(cal); 2266 2268 2267 // Add default subscription for default calendar. 2268 BwSubscription defSub = BwSubscription.makeSubscription(cal, 2269 cal.getName(), true, true, false); 2269 BwCalendar userrootCal = cal.getCalendar(); 2270 2271 // Add default subscription to the user root. 2272 BwSubscription defSub = BwSubscription.makeSubscription(userrootCal, 2273 userrootCal.getName(), 2274 true, true, false); 2270 2275 defSub.setOwner(user); 2271 2276 setupOwnedEntity(defSub); 2272 2277 2273 2278 prefs.addSubscription(defSub); 2274 2275 // Add default subscription for trash calendar.2276 2277 cal = cali.getTrashCalendar(user);2278 BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(),2279 false, false, false);2280 sub.setOwner(user);2281 setupOwnedEntity(sub);2282 2283 prefs.addSubscription(sub);2284 2279 2285 2280 // Add a default view for the default calendar subscription trunk/calendar3/webcommon/src/org/bedework/webcommon/calendars/UpdateCalendarAction.java
r436 r445 56 56 57 57 import org.bedework.calfacade.BwCalendar; 58 import org.bedework.calfacade.CalFacadeException;59 import org.bedework.calfacade.svc.BwPreferences;60 import org.bedework.calfacade.svc.BwSubscription;61 58 import org.bedework.calsvci.CalSvcI; 62 59 import org.bedework.webcommon.BwAbstractAction; … … 133 130 updateAuthPrefs(form, null, null, null, cal); 134 131 } 135 } else if (svci.getUserPrefs().getUserMode() == BwPreferences.basicMode) {136 // Auto subscribe.137 // XXX name should be derived from path.138 BwSubscription sub = BwSubscription.makeSubscription(cal, cal.getName(),139 true, true, false);140 try {141 svci.addSubscription(sub);142 } catch (CalFacadeException cfe) {143 if (CalFacadeException.duplicateSubscription.equals(cfe.getMessage())) {144 form.getErr().emit(cfe.getMessage());145 return "success"; // User will see message and we'll stay on page146 }147 148 throw cfe;149 }150 151 // Add it to the default view152 svci.addViewSubscription(null, sub);153 154 form.setSubscriptions(svci.getSubscriptions());155 132 } 156 133
