Changeset 336
- Timestamp:
- 04/06/06 10:55:20
- Files:
-
- trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Acl.java (modified) (1 diff)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Calendars.java (modified) (1 diff)
- trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/UserAuthUWDbImpl.java (modified) (4 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/BwCalendar.java (modified) (3 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/base/BwShareableContainedDbentity.java (modified) (1 diff)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/BwAuthUserPrefs.java (modified) (1 diff)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/BwPreferences.java (modified) (2 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/UserAuth.java (modified) (2 diffs)
- trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/UserAuthRO.java (modified) (2 diffs)
- trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java (modified) (3 diffs)
- trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java (modified) (2 diffs)
- trunk/calendar3/synchml/src/edu/rpi/cct/uwcal/synchml/common/Synchml.java (modified) (1 diff)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java (modified) (2 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java (modified) (1 diff)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/subs/SubscribeAction.java (modified) (3 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/subs/UnsubscribeAction.java (deleted)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/taglib/BaseTag.java (modified) (2 diffs)
- trunk/calendar3/webcommon/src/org/bedework/webcommon/views/UpdateViewAction.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/calendar3/access/src/edu/rpi/cct/uwcal/access/Acl.java
r331 r336 138 138 /** Was it succesful */ 139 139 public boolean accessAllowed; 140 141 public String toString() { 142 StringBuffer sb = new StringBuffer("CurrentAccess{"); 143 sb.append("acl="); 144 sb.append(acl); 145 146 sb.append("accessAllowed="); 147 sb.append(accessAllowed); 148 sb.append("}"); 149 150 return sb.toString(); 151 } 140 152 } 141 153 trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/Calendars.java
r331 r336 457 457 } 458 458 459 BwCalendar cal = (BwCalendar)subroot. clone();459 BwCalendar cal = (BwCalendar)subroot.shallowClone(); 460 460 // XXX Temp fix - add id to the clone 461 461 cal.setId(subroot.getId()); trunk/calendar3/calCore/src/org/bedework/calcore/hibernate/UserAuthUWDbImpl.java
r256 r336 128 128 */ 129 129 public void initialise(String userid, CallBack cb, 130 Object val) throws CalFacadeException { 130 Object val, 131 boolean debug) throws CalFacadeException { 131 132 curUser = userid; 132 133 this.cb = cb; … … 136 137 } 137 138 userAuthRO = null; 138 debug = getLogger().isDebugEnabled();139 this.debug = debug; 139 140 } 140 141 … … 150 151 */ 151 152 public void initialise(String userid, CallBack cb, 152 int val) throws CalFacadeException { 153 int val, 154 boolean debug) throws CalFacadeException { 153 155 curUser = userid; 154 156 this.cb = cb; … … 158 160 } 159 161 userAuthRO = null; 160 debug = getLogger().isDebugEnabled();162 this.debug = debug; 161 163 } 162 164 trunk/calendar3/calFacade/src/org/bedework/calfacade/BwCalendar.java
r320 r336 382 382 * ==================================================================== */ 383 383 384 /** Com apre this calendar and an object384 /** Compare this calendar and an object 385 385 * 386 386 * @param o object to compare. … … 412 412 413 413 toStringSegment(sb); 414 sb.append(" name=");414 sb.append(", name="); 415 415 sb.append(String.valueOf(getName())); 416 416 sb.append(", path="); … … 424 424 sb.append(", calendarCollection="); 425 425 sb.append(String.valueOf(getCalendarCollection())); 426 427 sb.append(", children("); 428 Iterator it = iterateChildren(); 429 boolean donech = false; 430 431 while (it.hasNext()) { 432 BwCalendar ch = (BwCalendar)it.next(); 433 434 if (!donech) { 435 donech = true; 436 } else { 437 sb.append(", "); 438 } 439 440 sb.append(ch.getPath()); 441 } 426 442 sb.append(")"); 443 444 if (getCurrentAccess() != null) { 445 sb.append(", currentAccess="); 446 sb.append(getCurrentAccess()); 447 } 448 sb.append("}"); 427 449 428 450 return sb.toString(); trunk/calendar3/calFacade/src/org/bedework/calfacade/base/BwShareableContainedDbentity.java
r128 r336 139 139 public void copyTo(BwShareableContainedDbentity val) { 140 140 super.copyTo(val); 141 val.setCalendar((BwCalendar)getCalendar(). clone());141 val.setCalendar((BwCalendar)getCalendar().shallowClone()); 142 142 } 143 143 } trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/BwAuthUserPrefs.java
r2 r336 509 509 510 510 while (it.hasNext()) { 511 nts.add((BwCalendar)((BwCalendar)it.next()). clone());511 nts.add((BwCalendar)((BwCalendar)it.next()).shallowClone()); 512 512 } 513 513 } trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/BwPreferences.java
r2 r336 79 79 private int workdayStart; 80 80 81 /* *Time in minutes for workday end, e.g. 17:30 is 105081 /* Time in minutes for workday end, e.g. 17:30 is 1050 82 82 */ 83 83 private int workdayEnd; 84 84 85 /* *When adding events do we prefer end date ("date")85 /* When adding events do we prefer end date ("date") 86 86 * or duration ("duration"). Note the values this field takes 87 87 * are internal values only - not meant for display. 88 88 */ 89 89 private String preferredEndType; 90 90 91 /** Value identifying an extra simple user mode - we just do stuff without 92 * asking 93 */ 94 public static final int extraSimpleMode = 0; 95 96 /** Value identifying a simple user mode - we hide some stuff but make 97 * fewer assumptions 98 */ 99 public static final int simpleMode = 1; 100 101 /** Value identifying an advanced user mode - reveal it in all its glory 102 */ 103 public static final int advancedMode = 2; 104 105 private int userMode; 106 91 107 /** Constructor 92 108 * … … 275 291 public String getPreferredEndType() { 276 292 return preferredEndType; 293 } 294 295 /** 296 * @param val 297 */ 298 public void setUserMode(int val) { 299 userMode = val; 300 } 301 302 /** 303 * @return int user mode 304 */ 305 public int getUserMode() { 306 return userMode; 277 307 } 278 308 trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/UserAuth.java
r2 r336 148 148 */ 149 149 public void initialise(String userid, CallBack cb, 150 Object val) throws CalFacadeException; 150 Object val, 151 boolean debug) throws CalFacadeException; 151 152 152 153 /** Initialise the implementing object with an access level. … … 172 173 */ 173 174 public void initialise(String userid, CallBack cb, 174 int val) throws CalFacadeException; 175 int val, 176 boolean debug) throws CalFacadeException; 175 177 176 178 /** =================================================================== trunk/calendar3/calFacade/src/org/bedework/calfacade/svc/UserAuthRO.java
r2 r336 71 71 */ 72 72 public void initialise(String userid, CallBack cb, 73 Object val) throws CalFacadeException { 73 Object val, 74 boolean debug) throws CalFacadeException { 74 75 throw new CalFacadeException("Method not accessible"); 75 76 } … … 97 98 */ 98 99 public void initialise(String userid, CallBack cb, 99 int val) throws CalFacadeException { 100 int val, 101 boolean debug) throws CalFacadeException { 100 102 throw new CalFacadeException("Method not accessible"); 101 103 } trunk/calendar3/calsvc/src/org/bedework/calsvc/CalSvc.java
r331 r336 465 465 } 466 466 467 public BwPreferences getUserPrefs() throws CalFacadeException {468 return dbi.getPreferences();469 }470 471 public BwPreferences getUserPrefs(BwUser user) throws CalFacadeException {472 return dbi.fetchPreferences(user);473 }474 475 public void updateUserPrefs(BwPreferences val) throws CalFacadeException {476 dbi.updatePreferences(val);477 }478 479 467 public UserAuth getUserAuth(String user, Object par) throws CalFacadeException { 480 468 if (userAuth != null) { … … 490 478 } 491 479 492 userAuth.initialise(user, getUserAuthCallBack(), par );480 userAuth.initialise(user, getUserAuthCallBack(), par, debug); 493 481 494 482 return userAuth; … … 558 546 publicLastmod = lastmod; 559 547 return true; 548 } 549 550 /* ==================================================================== 551 * Preferences 552 * ==================================================================== */ 553 554 public BwPreferences getUserPrefs() throws CalFacadeException { 555 return dbi.getPreferences(); 556 } 557 558 public BwPreferences getUserPrefs(BwUser user) throws CalFacadeException { 559 return dbi.fetchPreferences(user); 560 } 561 562 public void updateUserPrefs(BwPreferences val) throws CalFacadeException { 563 dbi.updatePreferences(val); 560 564 } 561 565 trunk/calendar3/calsvci/src/org/bedework/calsvci/CalSvcI.java
r331 r336 313 313 public abstract Collection getInstanceOwners() throws CalFacadeException; 314 314 315 /** Returns the current user preferences.316 *317 * @return BwPreferences prefs for the current user318 * @throws CalFacadeException319 */320 public abstract BwPreferences getUserPrefs() throws CalFacadeException;321 322 /** Returns the given user preferences.323 *324 * @param user325 * @return BwPreferences prefs for the given user326 * @throws CalFacadeException327 */328 public abstract BwPreferences getUserPrefs(BwUser user) throws CalFacadeException;329 330 /** Update the current user preferences.331 *332 * @param val BwPreferences prefs for the current user333 * @throws CalFacadeException334 */335 public abstract void updateUserPrefs(BwPreferences val) throws CalFacadeException;336 337 315 /** Get a UserAuth object which allows the application to determine what 338 316 * special rights the user has. … … 396 374 */ 397 375 public abstract boolean refreshNeeded() throws CalFacadeException; 376 377 /* ==================================================================== 378 * Preferences 379 * ==================================================================== */ 380 381 /** Returns the current user preferences. 382 * 383 * @return BwPreferences prefs for the current user 384 * @throws CalFacadeException 385 */ 386 public abstract BwPreferences getUserPrefs() throws CalFacadeException; 387 388 /** Returns the given user preferences. 389 * 390 * @param user 391 * @return BwPreferences prefs for the given user 392 * @throws CalFacadeException 393 */ 394 public abstract BwPreferences getUserPrefs(BwUser user) throws CalFacadeException; 395 396 /** Update the current user preferences. 397 * 398 * @param val BwPreferences prefs for the current user 399 * @throws CalFacadeException 400 */ 401 public abstract void updateUserPrefs(BwPreferences val) throws CalFacadeException; 398 402 399 403 /* ==================================================================== trunk/calendar3/synchml/src/edu/rpi/cct/uwcal/synchml/common/Synchml.java
r310 r336 271 271 public boolean deleteEvent(VEvent val) throws CalFacadeException { 272 272 // FIXME - We need a subscription to the calendar we are synching - second par 273 return deleteEvent(BwEventUtil.toEvent(svci.getIcalCallback(), null, null, val, debug).getEvent()); 273 return deleteEvent(BwEventUtil.toEvent(svci.getIcalCallback(), 274 null, // BwCalendar 275 null, // overrides 276 val, debug).getEvent()); 274 277 } 275 278 trunk/calendar3/webcommon/src/org/bedework/webcommon/BwAbstractAction.java
r331 r336 72 72 import org.bedework.calfacade.svc.BwAuthUserPrefs; 73 73 import org.bedework.calfacade.svc.BwSubscription; 74 import org.bedework.calfacade.svc.BwView;75 74 import org.bedework.calfacade.svc.EventInfo; 76 75 import org.bedework.calfacade.svc.UserAuth; … … 292 291 form.refreshIsNeeded(); 293 292 return true; 294 }295 296 protected String unsubscribe(HttpServletRequest request,297 BwActionFormBase form) throws Throwable {298 if (form.getGuest()) {299 return "noAccess"; // First line of defence300 }301 302 CalSvcI svc = form.fetchSvci();303 304 String name = request.getParameter("name");305 306 if (name == null) {307 // Assume no access308 form.getErr().emit("org.bedework.client.error.missingfield", "name");309 return "error";310 }311 312 BwSubscription sub = svc.findSubscription(name);313 314 if (sub == null) {315 form.getErr().emit("org.bedework.client.error.nosuchsubscription", name);316 return "notFound";317 }318 319 if (sub.getUnremoveable() && !form.getUserAuth().isSuperUser()) {320 return "noAccess"; // Only super user can remove the unremovable321 }322 323 Iterator it = svc.getViews().iterator();324 boolean reffed = false;325 while (it.hasNext()) {326 BwView v = (BwView)it.next();327 if (v.getSubscriptions().contains(sub)) {328 form.getErr().emit("org.bedework.client.error.subscription.reffed",329 v.getName());330 reffed = true;331 }332 }333 334 if (reffed) {335 return "reffed";336 }337 338 svc.removeSubscription(sub);339 form.getMsg().emit("org.bedework.client.message.subscription.removed");340 return "success";341 293 } 342 294 trunk/calendar3/webcommon/src/org/bedework/webcommon/BwActionFormBase.java
r324 r336 2158 2158 } 2159 2159 } 2160 trunk/calendar3/webcommon/src/org/bedework/webcommon/subs/SubscribeAction.java
r253 r336 55 55 56 56 import org.bedework.calfacade.CalFacadeException; 57 import org.bedework.calfacade.svc.BwPreferences; 57 58 import org.bedework.calfacade.svc.BwSubscription; 59 import org.bedework.calfacade.svc.BwView; 58 60 import org.bedework.calsvci.CalSvcI; 59 61 import org.bedework.webcommon.BwAbstractAction; … … 62 64 63 65 import edu.rpi.sss.util.Util; 66 67 import java.util.Iterator; 64 68 65 69 import javax.servlet.http.HttpServletRequest; … … 179 183 return true; 180 184 } 185 186 private String unsubscribe(HttpServletRequest request, 187 BwActionFormBase form) throws Throwable { 188 CalSvcI svc = form.fetchSvci(); 189 190 String name = request.getParameter("name"); 191 192 if (name == null) { 193 // Assume no access 194 form.getErr().emit("org.bedework.client.error.missingfield", "name"); 195 return "error"; 196 } 197 198 BwSubscription sub = svc.findSubscription(name); 199 200 if (sub == null) { 201 form.getErr().emit("org.bedework.client.error.nosuchsubscription", name); 202 return "notFound"; 203 } 204 205 if (sub.getUnremoveable() && !form.getUserAuth().isSuperUser()) { 206 return "noAccess"; // Only super user can remove the unremovable 207 } 208 209 /* Check for references in views. For user extra simple mode only we will 210 * automatically remove the subscription. For others we list the references 211 */ 212 213 Iterator it = svc.getViews().iterator(); 214 boolean reffed = false; 215 boolean autoRemove = !getPublicAdmin(form) && 216 (svc.getUserPrefs().getUserMode() == BwPreferences.extraSimpleMode); 217 218 while (it.hasNext()) { 219 BwView v = (BwView)it.next(); 220 if (v.getSubscriptions().contains(sub)) { 221 if (autoRemove) { 222 if (!svc.removeViewSubscription(v.getName(), sub)) { 223 form.getErr().emit("org.bedework.client.error.viewnotfound", 224 v.getName()); 225 return "error"; 226 } 227 } else { 228 form.getErr().emit("org.bedework.client.error.subscription.reffed", 229 v.getName()); 230 reffed = true; 231 } 232 } 233 } 234 235 if (reffed) { 236 return "reffed"; 237 } 238 239 svc.removeSubscription(sub); 240 form.getMsg().emit("org.bedework.client.message.subscription.removed"); 241 242 /* Refetch to tidy up */ 243 form.setSubscriptions(svc.getSubscriptions()); 244 245 return "success"; 246 } 181 247 } trunk/calendar3/webcommon/src/org/bedework/webcommon/taglib/BaseTag.java
r312 r336 58 58 import javax.servlet.jsp.tagext.TagSupport; 59 59 60 import org.apache.struts. util.RequestUtils;60 import org.apache.struts.taglib.TagUtils; 61 61 62 62 /** Base for simple Tags which provides some commonly used methods … … 79 79 throws JspTagException { 80 80 try { 81 Object o = RequestUtils.lookup(pageContext, name, property, scope);81 Object o = TagUtils.getInstance().lookup(pageContext, name, property, scope); 82 82 if (o == null) { 83 83 if (required) { trunk/calendar3/webcommon/src/org/bedework/webcommon/views/UpdateViewAction.java
r255 r336 128 128 } 129 129 130 131 130 if (!svc.removeViewSubscription(name, sub)) { 132 131 form.getErr().emit("org.bedework.client.error.viewnotfound", name);
