From 784c7e4ed0b85615fd765fffc79ee200c3fed161 Mon Sep 17 00:00:00 2001 From: helge Date: Thu, 4 May 2006 22:49:17 +0000 Subject: [PATCH] improved WebDAV locking git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1262 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- sope-appserver/NGObjWeb/ChangeLog | 4 ++ sope-appserver/NGObjWeb/Version | 2 +- .../WebDAV/SoObjectWebDAVDispatcher.m | 25 ++++++++--- .../NGObjWeb/WebDAV/SoWebDAVRenderer.h | 3 +- .../NGObjWeb/WebDAV/SoWebDAVRenderer.m | 43 ++++++++++++++++--- 5 files changed, 62 insertions(+), 15 deletions(-) diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 131e0d72..2a19499b 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,5 +1,9 @@ 2006-05-05 Helge Hess + * WebDAV/SoWebDAVRenderer.m: deliver more lockinfo fields when a lock + is acquired. This solves an issue with files being openened in Word + 2003 in readonly mode. (v4.5.232) + * v4.5.231 * WebDAV/SoWebDAVRenderer.m: major change: WebDAV properties which got diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 704a3bc2..c1996c31 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=231 +SUBMINOR_VERSION:=232 # v4.5.214 requires libNGExtensions v4.5.179 # v4.5.122 requires libNGExtensions v4.5.153 diff --git a/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m b/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m index ffb31018..22d47d72 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m +++ b/sope-appserver/NGObjWeb/WebDAV/SoObjectWebDAVDispatcher.m @@ -1,5 +1,6 @@ /* - Copyright (C) 2002-2005 SKYRIX Software AG + Copyright (C) 2002-2006 SKYRIX Software AG + Copyright (C) 2006 Helge Hess This file is part of SOPE. @@ -762,17 +763,29 @@ static NSTimeZone *gmt = nil; [self warnWithFormat:@"'depth' locking not supported yet (depth=%@)!", lockDepth]; } - if (ifValue) { + if (ifValue != nil) { [self warnWithFormat:@"'if' locking not supported yet, if: '%@'", ifValue]; } - // need to parse lockinfo + /* + TODO: parse lockinfo: + + + + + helge + + + Currently we assume exclusive/write ... (also see SoWebDAVRenderer) + */ + + /* Sample timeout: Second-180 */ token = [lockManager lockURI:[rq uri] timeout:[rq headerForKey:@"timeout"] - scope:@"exclusive" - type:@"write" - owner:nil]; + scope:@"exclusive" // TODO + type:@"write" // TODO + owner:nil]; // TODO if (token == nil) { /* already locked */ return [self httpException:423 /* locked */ diff --git a/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.h b/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.h index 26be4d45..9fd4f24b 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.h +++ b/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.h @@ -1,5 +1,6 @@ /* - Copyright (C) 2000-2005 SKYRIX Software AG + Copyright (C) 2000-2006 SKYRIX Software AG + Copyright (C) 2006 Helge Hess This file is part of SOPE. diff --git a/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m b/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m index 9c5c5c13..b7a1ad23 100644 --- a/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m +++ b/sope-appserver/NGObjWeb/WebDAV/SoWebDAVRenderer.m @@ -909,8 +909,10 @@ static BOOL formatOutput = NO; } - (BOOL)renderLockToken:(id)_object inContext:(WOContext *)_ctx { - /* TODO: this is a fake ! */ + // TODO: this is fake for most parts! The object needs to be some real + // object describing the lock, not just the token WOResponse *r; + id tmp; if (_object == nil) return NO; @@ -926,18 +928,45 @@ static BOOL formatOutput = NO; [r appendContentString:@""]; if (formatOutput) [r appendContentCharacter:'\n']; + // TODO: we assume a write token and exclusive access, also check the + // SoObjectWebDAVDispatcher + + [r appendContentString:@""]; + if (formatOutput) [r appendContentCharacter:'\n']; + + [r appendContentString:@""]; + if (formatOutput) [r appendContentCharacter:'\n']; + + /* write the depth */ + // TODO: we just give back the depth of the request ... + + if ([(tmp = [[_ctx request] headerForKey:@"depth"]) isNotEmpty]) { + [r appendContentString:@""]; + [r appendContentString:[tmp stringValue]]; + [r appendContentString:@""]; + if (formatOutput) [r appendContentCharacter:'\n']; + } + + // TODO: owner, eg ... + + /* write the timeout */ + // TODO: we just give back the timeout of the request ... + + if ([(tmp = [[_ctx request] headerForKey:@"timeout"]) isNotEmpty]) { + /* eg Second-604800 */ + [r appendContentString:@""]; + [r appendContentString:[tmp stringValue]]; + [r appendContentString:@""]; + if (formatOutput) [r appendContentCharacter:'\n']; + } + /* this is the href of the lock, not of the locked resource */ + [r appendContentString:@""]; [r appendContentString:[_object stringValue]]; [r appendContentString:@""]; if (formatOutput) [r appendContentCharacter:'\n']; - // TODO: locktype, eg - // TODO: lockscope, eg - // TODO: depth, eg Infinitiy - // TODO: owner, eg ... - // TODO: timeout, eg Second-604800 - [r appendContentString:@""]; [r appendContentString:@""]; [r appendContentString:@""]; -- 2.39.5