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;
}
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;
}
}
}
if (doDebug) {
[self logWithFormat:@"traverse%s: %@",
- _acquire ? "(acquire)" : "",
- [traversalPath componentsJoinedByString:@" => "]];
+ _acquire ? "(acquire)" : "",
+ [traversalPath componentsJoinedByString:@" => "]];
}
/* reset error */
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];
}
}
}
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;
}
}
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."];
}
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];