@implementation NSObject(SoObjectSoDAVImp)
- (NSArray *)defaultWebDAVPropertyNamesInContext:(id)_ctx {
+ // TODO: check for set in SoClass slots
static NSArray *defNames = nil;
if (defNames == nil) {
defNames = [[[NSUserDefaults standardUserDefaults]
return defNames;
}
+- (NSArray *)davComplianceClassesInContext:(id)_ctx {
+ /*
+ Class 1 is everything in WebDAV which is a MUST.
+
+ Class 2 adds the LOCK method, the supportedlock property, the lockdiscovery
+ property, the time-out response header and the lock-token request header.
+
+ In this method we check that by querying the lock manager. If the object
+ has one, it will return class 2, otherwise just class 1.
+ */
+ static NSArray *class1 = nil, *class2 = nil;
+
+ if (class1 == nil)
+ class1 = [[NSArray alloc] initWithObjects:@"1", nil];
+ if (class2 == nil)
+ class2 = [[NSArray alloc] initWithObjects:@"1", @"2", nil];
+
+ return ([self davLockManagerInContext:_ctx] != nil)
+ ? class2 : class1;
+}
+
+- (NSArray *)davAllowedMethodsInContext:(id)_ctx {
+ static NSArray *defMethods = nil;
+ NSMutableArray *allow;
+
+ if (defMethods == nil) {
+ defMethods = [[[NSUserDefaults standardUserDefaults]
+ arrayForKey:@"SoWebDAVDefaultAllowMethods"]
+ copy];
+ }
+
+ allow = [NSMutableArray arrayWithCapacity:16];
+ if (defMethods) [allow addObjectsFromArray:defMethods];
+
+ if ([self respondsToSelector:@selector(performWebDAVQuery:inContext:)]) {
+ [allow addObject:@"PROPFIND"];
+ [allow addObject:@"SEARCH"];
+ }
+ if ([self respondsToSelector:
+ @selector(davSetProperties:removePropertiesNamed:)])
+ [allow addObject:@"PROPPATCH"];
+
+ return allow;
+}
+
/* attributes */
- (BOOL)davIsCollection {
ctx = [[WOApplication application] context];
i = 0;
e = [self davChildKeysInContext:ctx];
- while ((childName = [e nextObject])) {
- if (![[self lookupName:childName inContext:ctx acquire:NO] davIsCollection])
+ while ((childName = [e nextObject]) != nil) {
+ if (![[self lookupName:childName inContext:ctx acquire:NO]davIsCollection])
i++;
}
return i;
return [self davURL];
}
- (id)davEntityTag {
- return [self davUid];
+ return nil;
}
- (BOOL)davIsStructuredDocument {