Monotone-Parent: 5e7e2018cb3fa2625cceaaa04d46251c7d1bbd09

Monotone-Revision: 10cd99d7bb60f6b8cd1fe6b59a1c9a647dd0ba3b

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-07-09T21:05:47
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2008-07-09 21:05:47 +00:00
parent 24f460e9b0
commit 13daab061a
1 changed files with 124 additions and 0 deletions

View File

@ -2094,6 +2094,95 @@ Index: sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m
return [self httpException:400 /* invalid request */
reason:@"XML entity expected for WebDAV REPORT."];
}
@@ -1601,8 +1601,60 @@
/* CalDAV */
- (id)doMKCALENDAR:(WOContext *)_ctx {
- return [self httpException:405 /* method not allowed */
- reason:@"CalDAV calendar creation not yet implemented."];
+ SoSecurityManager *sm;
+ NSException *e;
+ NSString *pathInfo;
+
+ pathInfo = [_ctx pathInfo];
+ if (![pathInfo isNotEmpty]) {
+ /* MKCALENDAR target already exists ... */
+ WOResponse *r;
+
+ [self logWithFormat:@"MKCALENDAR target exists !"];
+
+ r = [_ctx response];
+ [r setStatus:405 /* method not allowed */];
+ [r appendContentString:@"calendar collection already exists !"];
+ return r;
+ }
+
+ /* check permissions */
+
+ sm = [_ctx soSecurityManager];
+ e = [sm validatePermission:SoPerm_AddFolders
+ onObject:self->object
+ inContext:_ctx];
+ if (e != nil) return e;
+
+ /* check whether all the parent collections are available */
+ if ([pathInfo rangeOfString:@"/"].length > 0) {
+ return [self httpException:409 /* Conflict */
+ reason:
+ @"invalid WebDAV MKCALENDAR request, first create all "
+ @"parent collections !"];
+ }
+
+ /* check whether the object supports creating collections */
+
+ if (![self->object respondsToSelector:
+ @selector(davCreateCalendarCollection:inContext:)]) {
+ /* Note: this should never happen, as this is implemented on NSObject */
+
+ [self logWithFormat:@"MKCALENDAR: object '%@' path-info '%@'",
+ self->object, pathInfo];
+ return [self httpException:405 /* not allowed */
+ reason:
+ @"this object cannot create a new calendar collection with MKCALENDAR"];
+ }
+
+ if ((e = [self->object davCreateCalendarCollection:pathInfo inContext:_ctx])) {
+ [self debugWithFormat:@"creation of calendar collection '%@' failed: %@",
+ pathInfo, e];
+ return e;
+ }
+
+ [self debugWithFormat:@"created calendar collection."];
+ return [NSNumber numberWithBool:YES];
}
/* DAV access control lists */
Index: sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m
===================================================================
--- sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m (révision 1623)
+++ sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m (copie de travail)
@@ -277,7 +277,8 @@
ok = [self renderLockToken:_object inContext:_ctx];
break;
case 'M':
- if ([m isEqualToString:@"MKCOL"])
+ if ([m isEqualToString:@"MKCOL"]
+ || [m isEqualToString:@"MKCALENDAR"])
ok = [self renderMkColResult:_object inContext:_ctx];
else if ([m isEqualToString:@"MOVE"]) {
ok = [self renderStatusResult:_object
Index: sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAV.h
===================================================================
--- sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAV.h (révision 1623)
+++ sope-appserver/NGObjWeb/WebDAV/SoObject+SoDAV.h (copie de travail)
@@ -62,6 +62,7 @@
properties:(NSDictionary *)_props
inContext:(id)_ctx;
- (NSException *)davCreateCollection:(NSString *)_name inContext:(id)_ctx;
+- (NSException *)davCreateCalendarCollection:(NSString *)_name inContext:(id)_ctx;
- (NSException *)davMoveToTargetObject:(id)_target newName:(NSString *)_name
inContext:(id)_ctx;
Index: sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m
===================================================================
--- sope-appserver/NGObjWeb/DynamicElements/WOHyperlinkInfo.m (révision 1623)
@ -2309,6 +2398,20 @@ Index: sope-appserver/NGObjWeb/SoObjects/SoObject.m
}
}
Index: sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m
===================================================================
--- sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m (révision 1623)
+++ sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m (copie de travail)
@@ -195,7 +195,8 @@
isCreateIfMissingMethod = YES;
else if ([m isEqualToString:@"PROPPATCH"])
isCreateIfMissingMethod = YES;
- else if ([m isEqualToString:@"MKCOL"])
+ else if ([m isEqualToString:@"MKCOL"]
+ || [m isEqualToString:@"MKCALENDAR"])
/* this one is strictly creating */
isCreateMethod = YES;
// TODO: the following are only create-if-missing on the target!
Index: sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m
===================================================================
--- sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m (révision 1623)
@ -2334,6 +2437,27 @@ Index: sope-appserver/NGObjWeb/WOHttpAdaptor/WOHttpTransaction.m
@end /* WOHttpAdaptor */
@implementation WOCoreApplication(SimpleParserSelection)
Index: sope-appserver/NGObjWeb/Defaults.plist
===================================================================
--- sope-appserver/NGObjWeb/Defaults.plist (révision 1623)
+++ sope-appserver/NGObjWeb/Defaults.plist (copie de travail)
@@ -216,7 +216,7 @@
SoWebDAVDisableCrossHostMoveCheck = NO;
SoWebDAVDefaultAllowMethods = (
- GET, HEAD, POST, OPTIONS, MKCOL, DELETE, PUT,
+ GET, HEAD, POST, OPTIONS, MKCOL, MKCALENDAR, DELETE, PUT,
LOCK, UNLOCK, COPY, MOVE
/* , NOTIFY, POLL, SUBSCRIBE, UNSUBSCRIBE */
);
@@ -224,6 +224,7 @@
SoWebDAVDetectionMethods = (
OPTIONS,
MKCOL,
+ MKCALENDAR,
PROPFIND,
PROPPATCH,
DELETE,
Index: sope-appserver/NGObjWeb/NGHttp/NGHttpRequest.h
===================================================================
--- sope-appserver/NGObjWeb/NGHttp/NGHttpRequest.h (révision 1623)