]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1402 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 24 Apr 2008 01:25:04 +0000 (01:25 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Thu, 24 Apr 2008 01:25:04 +0000 (01:25 +0000)
14 files changed:
ChangeLog
Main/GNUmakefile.preamble
OGoContentStore/GNUmakefile
SOPE/GDLContentStore/GNUmakefile
SOPE/NGCards/GNUmakefile
SoObjects/SOGo/DAVReportMap.plist [new file with mode: 0644]
SoObjects/SOGo/GNUmakefile
SoObjects/SOGo/GNUmakefile.preamble
SoObjects/SOGo/SOGoContentObject.m
SoObjects/SOGo/SOGoFolder.m
SoObjects/SOGo/SOGoObject.m
SoObjects/SOGo/SOGoUser.m
SoObjects/SOGo/SOGoUserFolder.m
UI/SOGoUI/GNUmakefile

index 327220f8fe68a8c1d8854662fd8823731c1d2de6..5d53d29d33b59c35452973e97ae61dae9402dec6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,33 @@
+2008-04-23  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
+
+       * SoObjects/SOGo/SOGoObject.m ([SOGoObject +initialize]): the
+       module is now a framework and we now load the new DAVReportMap
+       description file.
+       ([-davOwner]): the principal URL is now based on the DAV
+       application URL.
+       ([SOGoObject
+       -lookupName:lookupNameinContext:localContextacquire:acquire]): we
+       now lookup report methods from here (code from SOGoFolder). The
+       method has changed to refer to the new DAVReportMAP description
+       file in order to resolve the lookups on self.
+       ([SOGoObject -davSupportedReportSet]): implemented the new
+       "supported-report-set" dav method, based on the new mechanism
+       described above.
+
+       * SoObjects/SOGo/SOGoFolder.m: REPORT lookups are now done
+       directly from SOGoObject.
+
+       * SoObjects/SOGo/SOGoUser.m ([SOGoUser
+       -initWithLogin:newLoginroles:newRoles]): we make sure realUID is
+       not an empty string.
+
+       * SoObjects/SOGo/SOGoUserFolder.m ([SOGoUserFolder
+       -davResourceType]): we declare self as a "principal".
+
+       * SoObjects/SOGo/SOGoContentObject.m ([SOGoContentObject
+       -davContentLength]): the content length should is now based on the
+       UTF-8 encoding.
+
 2008-04-22  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
        * UI/Scheduler/UIxCalendarSelector.m ([UIxCalendarSelector
index 991110f9f27a62b4350d971c6128ccfcd308eff6..89fd3d01a50b0dc8b9657a6a269954f202fbf52c 100644 (file)
@@ -11,7 +11,7 @@ ADDITIONAL_INCLUDE_DIRS += \
        -I.. -DSOGO_BUILD_DATE="@\"$(BUILD_DATE)\""
 
 ADDITIONAL_LIB_DIRS += \
-       -L../SoObjects/SOGo/$(GNUSTEP_OBJ_DIR)/ \
+       -L../SoObjects/SOGo/SOGo.framework  \
        -L../OGoContentStore/$(GNUSTEP_OBJ_DIR)/ \
        -L../SOPE/NGCards/$(GNUSTEP_OBJ_DIR)/
 
index 1ef0149f14e341d595f6b2133b15298db2abb436..b697967e1d53825854b3270772e46d9917603e2c 100644 (file)
@@ -12,7 +12,6 @@ TYPEMODELS_DIR = $(SOGO_TYPEMODELS)
 libOGoContentStore_HEADER_FILES_DIR         = .
 libOGoContentStore_HEADER_FILES_INSTALL_DIR = /OGoContentStore
 libOGoContentStore_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
-libOGoContentStore_INSTALL_DIR=$(SOGO_SYSLIBDIR)
 
 ADDITIONAL_INCLUDE_DIRS += -I../SOPE
 ADDITIONAL_LIB_DIRS += -L../SOPE/GDLContentStore/obj
index eca654b2fb84285cbb1182007cb5595baa7a96a9..ca90d783651ffea19eba6c516082b0cf0251d734 100644 (file)
@@ -14,7 +14,6 @@ endif
 
 libGDLContentStore_PCH_FILE = common.h
 libGDLContentStore_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
-libGDLContentStore_INSTALL_DIR=$(SOGO_SYSLIBDIR)
 libGDLContentStore_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
 
 TOOL_NAME = gcs_ls gcs_mkdir gcs_cat gcs_recreatequick gcs_gensql
index 252fbbdcbe2b2a3e449ad725f42d4c59b8ceeb77..563c21346ca85f14d41752f06eec0a13d56afea3 100644 (file)
@@ -15,7 +15,6 @@ endif
 libNGCards_HEADER_FILES_DIR         = .
 libNGCards_HEADER_FILES_INSTALL_DIR = /NGCards
 libNGCards_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
-libNGCards_INSTALL_DIR=$(SOGO_SYSLIBDIR)
 libNGCards_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBMINOR_VERSION)
 
 libNGCards_HEADER_FILES =              \
diff --git a/SoObjects/SOGo/DAVReportMap.plist b/SoObjects/SOGo/DAVReportMap.plist
new file mode 100644 (file)
index 0000000..5481dcd
--- /dev/null
@@ -0,0 +1,17 @@
+{ /* -*-java-*- */
+  /* CalDAV */
+  "{urn:ietf:params:xml:ns:caldav}calendar-query" = davCalendarQuery;
+  "{urn:ietf:params:xml:ns:caldav}calendar-multiget" = davCalendarMultiget;
+
+  /* CardDAV */
+  "{urn:ietf:params:xml:ns:carddav}addressbook-query" = davAddressbookQuery;
+  "{urn:ietf:params:xml:ns:carddav}addressbook-multiget"
+    = davAddressbookMultiget;
+  "{urn:ietf:params:xml:ns:carddav}supported-collation-set"
+    = davSupportedCollectionSet;
+
+  /* Inverse DAV */
+  "{urn:inverse:params:xml:ns:inverse-dav}collection-query"
+    = davCollectionQuery;
+  "{urn:inverse:params:xml:ns:inverse-dav}acl-query" = davAclQuery;
+}
index 4a00f5d597ecc8d5c771ba496c8d8f5299565972..29432aa3c6891b1381038a5e1ddccc98b88906f6 100644 (file)
@@ -5,7 +5,9 @@ include $(GNUSTEP_MAKEFILES)/common.make
 -include ../../Version
 -include ./Version
 
-LIBRARY_NAME = libSOGo
+FRAMEWORK_NAME = SOGo
+
+SOGo_INSTALL_DIR = $(SOGO_LIBDIR)
 
 TOOL_NAME = \
 #      agenor_email2uid        \
@@ -13,13 +15,9 @@ TOOL_NAME = \
 #      agenor_emails4uid       \
 #      agenor_defaults
 
-libSOGo_INTERFACE_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
-libSOGo_INSTALL_DIR=$(SOGO_SYSLIBDIR)
-
-libSOGo_HEADER_FILES_DIR         = .
-libSOGo_HEADER_FILES_INSTALL_DIR = /SOGo
+SOGo_VERSION=$(MAJOR_VERSION).$(MINOR_VERSION)
 
-libSOGo_HEADER_FILES = \
+SOGo_HEADER_FILES = \
        SOGoCache.h                     \
        SOGoObject.h                    \
        SOGoContentObject.h             \
@@ -56,7 +54,7 @@ libSOGo_HEADER_FILES = \
        \
        WORequest+SOGo.h
 
-libSOGo_OBJC_FILES = \
+SOGo_OBJC_FILES = \
        SOGoCache.m                     \
        SOGoObject.m                    \
        SOGoContentObject.m             \
@@ -94,6 +92,9 @@ libSOGo_OBJC_FILES = \
        \
        WORequest+SOGo.m
 
+SOGo_RESOURCE_FILES = \
+       DAVReportMap.plist
+
 # tools
 
 agenor_email2uid_OBJC_FILES  += agenor_email2uid.m
@@ -106,10 +107,9 @@ ADDITIONAL_INCLUDE_DIRS += -I../../SOPE/
 ADDITIONAL_LIB_DIRS += -L../../SOPE/GDLContentStore/obj/
 
 -include GNUmakefile.preamble
-include ../common.make
 ifneq ($(FHS_INSTALL_ROOT),)
 GNUSTEP_HEADERS=$(DESTDIR)$(FHS_INSTALL_ROOT)/include
 endif
-include $(GNUSTEP_MAKEFILES)/library.make
+include $(GNUSTEP_MAKEFILES)/framework.make
 include $(GNUSTEP_MAKEFILES)/tool.make
 -include GNUmakefile.postamble
index f49ab0b73216ea4ca252e673edf9a64694e9a023..c2edd5290fd95a4640ad0b122bdd7ba63a02bca2 100644 (file)
@@ -1,10 +1,8 @@
 # compilation settings
 
-libSOGo_INCLUDE_DIRS += -I.. -I../../..
+SOGo_INCLUDE_DIRS += -I.. -I../.. -DSOGO_MAJOR_VERSION="\"$(MAJOR_VERSION)\"" -DSOGO_MINOR_VERSION="\"$(MINOR_VERSION)\""
 
-SYSTEM_LIB_DIR += -L/usr/local/lib
-
-libSOGo_LIBRARIES_DEPEND_UPON += \
+SOGo_LIBRARIES_DEPEND_UPON += \
        -lOGoContentStore       \
        -lGDLAccess             \
        -lNGObjWeb              \
index a4bfbc3775742e6a7d85ac40cc8b3c21e6d09690..af4e3b53159d9275b1b3e3f88d1ba2c1b431e2a8 100644 (file)
   content = [record objectForKey: @"c_content"];
 
   return [NSString stringWithFormat: @"%u",
-                  [content lengthOfBytesUsingEncoding: NSISOLatin1StringEncoding]];
+                  [content lengthOfBytesUsingEncoding: NSUTF8StringEncoding]];
 }
 
 - (NSException *) davMoveToTargetObject: (id) _target
index b01bfe5a52319edaca378ad5905d6d003f5f86e4..1d821ae31c3bbd84bf3c855ad64551e29b60d222 100644 (file)
@@ -24,8 +24,6 @@
 #import <Foundation/NSString.h>
 #import <Foundation/NSURL.h>
 
-#import <NGObjWeb/SoSelectorInvocation.h>
-
 #import <SaxObjC/XMLNamespaces.h>
 
 #import "NSString+Utilities.h"
   return nil;
 }
 
-- (id) lookupName: (NSString *) lookupName
-        inContext: (id) localContext
-          acquire: (BOOL) acquire
-{
-  id obj;
-  NSArray *davNamespaces;
-  NSDictionary *davInvocation;
-  NSString *objcMethod;
-
-  obj = [super lookupName: lookupName inContext: localContext
-              acquire: acquire];
-  if (!obj)
-    {
-      davNamespaces = [self davNamespaces];
-      if ([davNamespaces count] > 0)
-       {
-         davInvocation = [lookupName asDavInvocation];
-         if (davInvocation
-             && [davNamespaces
-                  containsObject: [davInvocation objectForKey: @"ns"]])
-           {
-             objcMethod = [[davInvocation objectForKey: @"method"]
-                            davMethodToObjC];
-             obj = [[SoSelectorInvocation alloc]
-                     initWithSelectorNamed:
-                       [NSString stringWithFormat: @"%@:", objcMethod]
-                     addContextParameter: YES];
-             [obj autorelease];
-           }
-       }
-    }
-
-  return obj;
-}
-
 #warning we should remove this method
 - (NSArray *) toOneRelationshipKeys
 {
index 678f6a3c188a57b8a9018c54ffc45ec7d2918aa0..eada235b9e1024362e868cea5eb6e8a28b26cabd 100644 (file)
@@ -28,6 +28,8 @@
 
 #import <Foundation/NSBundle.h>
 #import <Foundation/NSClassDescription.h>
+#import <Foundation/NSFileManager.h>
+#import <Foundation/NSPathUtilities.h>
 #import <Foundation/NSString.h>
 #import <Foundation/NSUserDefaults.h>
 #import <Foundation/NSURL.h>
@@ -36,6 +38,8 @@
 #import <NGObjWeb/SoClass.h>
 #import <NGObjWeb/SoClassSecurityInfo.h>
 #import <NGObjWeb/SoObject+SoDAV.h>
+#import <NGObjWeb/SoSelectorInvocation.h>
+#import <NGObjWeb/SoWebDAVValue.h>
 #import <NGObjWeb/WEClientCapabilities.h>
 #import <NGObjWeb/WOApplication.h>
 #import <NGObjWeb/WOContext.h>
@@ -56,6 +60,7 @@
 #import "NSArray+Utilities.h"
 #import "NSCalendarDate+SOGo.h"
 #import "NSDictionary+Utilities.h"
+#import "NSObject+Utilities.h"
 #import "NSString+Utilities.h"
 #import "SOGoCache.h"
 #import "SOGoDAVAuthenticator.h"
@@ -69,6 +74,8 @@
 static BOOL kontactGroupDAV = YES;
 static BOOL sendACLAdvisories = NO;
 
+static NSDictionary *reportMap = nil;
+
 @interface SOGoObject(Content)
 - (NSString *) contentAsString;
 @end
@@ -164,6 +171,31 @@ static BOOL sendACLAdvisories = NO;
 
 @implementation SOGoObject
 
++ (void) _loadReportMap
+{
+  NSFileManager *fm;
+  NSEnumerator *paths;
+  NSString *currentPath, *filename;
+
+  [self logWithFormat: @"Loading DAV REPORT map:"];
+
+  fm = [NSFileManager defaultManager];
+  paths = [NSStandardLibraryPaths() objectEnumerator];
+  while (!reportMap && (currentPath = [paths nextObject]))
+    {
+      filename = [NSString stringWithFormat: @"%@/SOGo-%s.%s/SOGo.framework"
+                          @"/Resources/DAVReportMap.plist",
+                          currentPath,
+                          SOGO_MAJOR_VERSION, SOGO_MINOR_VERSION];
+      [self logWithFormat: @"  %@", filename];
+      if ([fm fileExistsAtPath: filename])
+       {
+         reportMap = [[NSDictionary alloc] initWithContentsOfFile: filename];
+         [self logWithFormat: @"found!"];
+       }
+    }
+}
+
 + (void) initialize
 {
   NSUserDefaults *ud;
@@ -172,6 +204,8 @@ static BOOL sendACLAdvisories = NO;
   kontactGroupDAV = ![ud boolForKey:@"SOGoDisableKontact34GroupDAVHack"];
   sendACLAdvisories = [ud boolForKey: @"SOGoACLsSendEMailNotifications"];
 
+  if (!reportMap)
+    [self _loadReportMap];
 //   SoClass security declarations
   
 //   require View permission to access the root (bound to authenticated ...)
@@ -276,8 +310,8 @@ static BOOL sendACLAdvisories = NO;
 /* DAV ACL properties */
 - (NSString *) davOwner
 {
-  return [NSString stringWithFormat: @"%@users/%@",
-                   [self rootURLInContext: context],
+  return [NSString stringWithFormat: @"%@%@",
+                   [WOApplication davURL],
                   [self ownerInContext: nil]];
 }
 
@@ -555,12 +589,32 @@ static BOOL sendACLAdvisories = NO;
   return ma;
 }
 
+- (NSString *) _reportSelector: (NSString *) reportName
+{
+  NSString *methodName, *objcMethod, *resultName;
+  SEL reportSel;
+
+  resultName = nil;
+
+  methodName = [reportMap objectForKey: reportName];
+  if (methodName)
+    {
+      objcMethod = [NSString stringWithFormat: @"%@:", methodName];
+      reportSel = NSSelectorFromString (objcMethod);
+      if ([self respondsToSelector: reportSel])
+       resultName = objcMethod;
+    }
+
+  return resultName;
+}
+
 - (id) lookupName: (NSString *) lookupName
         inContext: (id) localContext
           acquire: (BOOL) acquire
 {
   id obj;
   SOGoCache *cache;
+  NSString *objcMethod;
 
   cache = [SOGoCache sharedCache];
   obj = [cache objectNamed: lookupName inContainer: self];
@@ -568,10 +622,21 @@ static BOOL sendACLAdvisories = NO;
     {
       obj = [[self soClass] lookupKey: lookupName inContext: localContext];
       if (obj)
+       [obj bindToObject: self inContext: localContext];
+      else
        {
-         [obj bindToObject: self inContext: localContext];
-         [cache registerObject: obj withName: lookupName inContainer: self];
+         objcMethod = [self _reportSelector: lookupName];
+         if (objcMethod)
+           {
+             obj = [[SoSelectorInvocation alloc]
+                     initWithSelectorNamed: objcMethod
+                     addContextParameter: YES];
+             [obj autorelease];
+           }
        }
+
+      if (obj)
+       [cache registerObject: obj withName: lookupName inContainer: self];
     }
 
   return obj;
@@ -625,13 +690,14 @@ static BOOL sendACLAdvisories = NO;
 
 - (id) DELETEAction: (id) _ctx
 {
-  NSException *error;
+  id result;
 
-  if ((error = [self delete]) != nil)
-    return error;
-  
+  result = [self delete];
   /* Note: returning 'nil' breaks in SoObjectRequestHandler */
-  return [NSNumber numberWithBool:YES]; /* delete worked out ... */
+  if (!result)
+    result = [NSNumber numberWithBool: YES]; /* delete worked out ... */
+  
+  return result;
 }
 
 - (BOOL) isFolderish
@@ -1329,8 +1395,10 @@ static BOOL sendACLAdvisories = NO;
       if ([content length])
        {
          [r setStatus: 207];
-         [r setHeader: @"text/xml; charset=\"utf-8\"" forKey: @"content-type"];
-         [r appendContentString: @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"];
+         [r setHeader: @"application/xml; charset=\"utf-8\""
+            forKey: @"content-type"];
+         [r appendContentString:
+              @"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"];
          [r appendContentString: content];
        }
       else
@@ -1375,4 +1443,25 @@ static BOOL sendACLAdvisories = NO;
   return exception;
 }
 
+- (NSArray *) davSupportedReportSet
+{
+  NSEnumerator *reportKeys;
+  NSMutableArray *reportSet;
+  NSString *currentKey, *currentValue;
+
+  reportSet = [NSMutableArray array];
+
+  reportKeys = [[reportMap allKeys] objectEnumerator];
+  while ((currentKey = [reportKeys nextObject]))
+    if ([self _reportSelector: currentKey])
+      {
+       currentValue = [[currentKey asDavInvocation]
+                        keysWithFormat: @"<%{method} xmlns=\"%{ns}\"/>"];
+       [reportSet addObject: [SoWebDAVValue valueForObject: currentValue
+                                            attributes: nil]];
+      }
+
+  return [SOGoDAVSet davSetWithArray: reportSet ofValuesTaggedAs: @"report"];
+}
+
 @end /* SOGoObject */
index db9b6dcbe9f6cd55ae7da01e84439aac859a881e..1932e9f03588d3f3b3d7ce56a3ed4991df9402b1 100644 (file)
@@ -194,7 +194,7 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
                  objectForKey: @"c_uid"];
     }
 
-  if (realUID)
+  if ([realUID length])
     self = [super initWithLogin: realUID roles: newRoles];
   else
     {
index a3a6dc7dbf5fa49fd27f7976d34a2d5878597f79..a7e6ba5147f65ca9ad3e450f711b5f1ebd44fe42 100644 (file)
   return results;
 }
 
+- (NSArray *) davResourceType
+{
+  NSMutableArray *rType;
+
+  rType = [NSMutableArray arrayWithArray: [super davResourceType]];
+  [rType addObject: @"principal"];
+
+  return rType;
+}
+
 - (NSString *) _baseDAVURLWithSuffix: (NSString *) suffix
 {
   NSURL *prefixURL;
index aca9621e179ce6e147cbb2e4dc7966ec5d45a5d7..7b76d73e98b63979c6cb2d49a42a67da34f5f1b1 100644 (file)
@@ -11,7 +11,6 @@ LIBRARY_NAME = libSOGoUI
 libSOGoUI_HEADER_FILES_DIR         = .
 libSOGoUI_HEADER_FILES_INSTALL_DIR = /SOGoUI
 libSOGoUI_INTERFACE_VERSION       = $(MAJOR_VERSION).$(MINOR_VERSION)
-libSOGoUI_INSTALL_DIR=$(SOGO_SYSLIBDIR)
 
 libSOGoUI_HEADER_FILES +=      \
        \