From: znek Date: Wed, 25 Jan 2006 16:14:16 +0000 (+0000) Subject: minor code cleanups X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f68206848134c98413018759a866cd788d520aa;p=sope minor code cleanups git-svn-id: http://svn.opengroupware.org/SOPE/trunk@1204 e4a50df8-12e2-0310-a44c-efbce7f8a7e3 --- diff --git a/sope-appserver/NGObjWeb/ChangeLog b/sope-appserver/NGObjWeb/ChangeLog index 1274dd54..adfb7394 100644 --- a/sope-appserver/NGObjWeb/ChangeLog +++ b/sope-appserver/NGObjWeb/ChangeLog @@ -1,3 +1,7 @@ +2006-01-25 Marcus Mueller + + * SoObjects/SoObject+Traversal.m: minor code cleanups (v4.5.217) + 2005-11-21 Helge Hess * WebDAV/SoObjectWebDAVDispatcher.m: set 'public' header in case the diff --git a/sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m b/sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m index 371e8bbe..c695ca12 100644 --- a/sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m +++ b/sope-appserver/NGObjWeb/SoObjects/SoObject+Traversal.m @@ -96,12 +96,14 @@ static BOOL _isDebugOn(void) { sm = [_ctx soSecurityManager]; if ((obj = [self traverseKey:_name inContext:_ctx]) != nil) { - *_error = [sm validateValue:obj forName:_name ofObject:self - inContext:_ctx]; + *_error = [sm validateValue:obj + forName:_name + ofObject:self + inContext:_ctx]; if (*_error != nil) { /* not allowed ! */ if (debugTraversal) - [self debugWithFormat:@" value of key '%@' did not validate !",_name]; + [self debugWithFormat:@" value of key '%@' did not validate !",_name]; return nil; } @@ -124,20 +126,20 @@ static BOOL _isDebugOn(void) { NSException *e; if ((e = [obj validateName:_name inContext:_ctx])) { - /* access restriction */ - *_error = e; - return nil; + /* access restriction */ + *_error = e; + return nil; } if ((obj = [obj traverseKey:_name inContext:_ctx])) { - /* found .. */ - e = [sm validateValue:obj forName:_name - ofObject:self inContext:_ctx]; - if (e) { - *_error = e; - return nil; - } - return obj; + /* found .. */ + e = [sm validateValue:obj forName:_name + ofObject:self inContext:_ctx]; + if (e) { + *_error = e; + return nil; + } + return obj; } } } @@ -172,8 +174,8 @@ static BOOL _isDebugOn(void) { if (doDebug) { [self logWithFormat:@"traverse%s: %@", - _acquire ? "(acquire)" : "", - [traversalPath componentsJoinedByString:@" => "]]; + _acquire ? "(acquire)" : "", + [traversalPath componentsJoinedByString:@" => "]]; } /* reset error */ @@ -185,18 +187,19 @@ static BOOL _isDebugOn(void) { if ((m = [rq method]) != nil) { if ([m isEqualToString:@"PUT"]) - isCreateIfMissingMethod = YES; + isCreateIfMissingMethod = YES; else if ([m isEqualToString:@"PROPPATCH"]) - isCreateIfMissingMethod = YES; + isCreateIfMissingMethod = YES; else if ([m isEqualToString:@"MKCOL"]) - /* this one is strictly creating */ - isCreateMethod = YES; - // TODO: the following are only create-if-missing on the target! - else if ([m isEqualToString:@"MOVE"] || - [m isEqualToString:@"COPY"]) { - isCreateIfMissingMethod = - [[(WOContext *)_ctx objectForKey:@"isDestinationPathLookup"] - boolValue]; + /* this one is strictly creating */ + isCreateMethod = YES; + // TODO: the following are only create-if-missing on the target! + else if ([m isEqualToString:@"MOVE"] || + [m isEqualToString:@"COPY"]) + { + isCreateIfMissingMethod = + [[(WOContext *)_ctx objectForKey:@"isDestinationPathLookup"] + boolValue]; } } } @@ -226,16 +229,16 @@ static BOOL _isDebugOn(void) { if (i == (count - 1)) { /* - is last object, special handling for MKCOL, with MKCOL queries - the last part of the URI is a collection to be created and not - yet in the object tree ... + is last object, special handling for MKCOL, with MKCOL queries + the last part of the URI is a collection to be created and not + yet in the object tree ... */ // TODO: should check whether the resource exists, but access is denied if (isCreateMethod) { - [_ctx setPathInfo:name]; + [_ctx setPathInfo:name]; if (doDebug) - [self logWithFormat:@"create-method: PATH_INFO: %@", name]; - break; + [self logWithFormat:@"create-method: PATH_INFO: %@", name]; + break; } } @@ -245,39 +248,39 @@ static BOOL _isDebugOn(void) { acquire:_acquire]; if (nextObject == nil) { if (doDebug) { - [self logWithFormat:@" traverse miss: name=%@%s: i=%i,count=%i", - name, _acquire ? ", acquire" : "", i, count]; + [self logWithFormat:@" traverse miss: name=%@%s: i=%i,count=%i", + name, _acquire ? ", acquire" : "", i, count]; } if (i == (count - 1)) { - /* - Is last object, special handling for PUT, with PUT queries - the last part of the URI is allowed to be missing. If this - is the case, the PUT is actually a "creation" operation. - The same goes for PROPPATCH. - */ - // should check whether the resource exists, but access is denied - if (isCreateIfMissingMethod) { - [_ctx setPathInfo:name]; - if (doDebug) - [self logWithFormat:@"create-if-missing: PATH_INFO: %@", name]; - break; - } - if (doDebug) [self logWithFormat:@" miss is last object."]; + /* + Is last object, special handling for PUT, with PUT queries + the last part of the URI is allowed to be missing. If this + is the case, the PUT is actually a "creation" operation. + The same goes for PROPPATCH. + */ + // should check whether the resource exists, but access is denied + if (isCreateIfMissingMethod) { + [_ctx setPathInfo:name]; + if (doDebug) + [self logWithFormat:@"create-if-missing: PATH_INFO: %@", name]; + break; + } + if (doDebug) [self logWithFormat:@" miss is last object."]; } if (error != nil) { - if (doDebug) [self logWithFormat:@" handle miss error: %@", error]; - currentObject = [currentObject handleValidationError:error - duringTraveralOfKey:name - inContext:_ctx]; - if (currentObject == nil) { - if (_error) - *_error = error; - else - currentObject = error; - break; - } - if (doDebug) [self logWithFormat:@" miss error continues ..."]; + if (doDebug) [self logWithFormat:@" handle miss error: %@", error]; + currentObject = [currentObject handleValidationError:error + duringTraveralOfKey:name + inContext:_ctx]; + if (currentObject == nil) { + if (_error) + *_error = error; + else + currentObject = error; + break; + } + if (doDebug) [self logWithFormat:@" miss error continues ..."]; } if (doDebug) [self logWithFormat:@" got no error for miss."]; } @@ -350,9 +353,9 @@ static BOOL _isDebugOn(void) { context = [WOContext context]; result = [self traversePathArray:_tp - inContext:context - error:&error - acquire:_acquire]; + inContext:context + error:&error + acquire:_acquire]; result = error ? [error retain] : [result retain]; } [pool release]; diff --git a/sope-appserver/NGObjWeb/Version b/sope-appserver/NGObjWeb/Version index 9498814d..779d5618 100644 --- a/sope-appserver/NGObjWeb/Version +++ b/sope-appserver/NGObjWeb/Version @@ -1,6 +1,6 @@ # version file -SUBMINOR_VERSION:=216 +SUBMINOR_VERSION:=217 # v4.5.214 requires libNGExtensions v4.5.179 # v4.5.122 requires libNGExtensions v4.5.153