]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1077 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 5 Jun 2007 15:45:31 +0000 (15:45 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Tue, 5 Jun 2007 15:45:31 +0000 (15:45 +0000)
ChangeLog
SoObjects/Appointments/product.plist
SoObjects/Mailer/SOGoMailFolder.m
SoObjects/SOGo/SOGoObject.m
UI/SOGoUI/SOGoACLAdvisory.m

index 0a9ea4df2d7067706b96f3944d8971efdd0f4e62..415c50a45c9bae0e70825115142c23ad62853247 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2007-06-05  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
+
+       * SoObjects/SOGo/SOGoObject.m ([SOGoObject
+       -_urlPreferringParticle:expectedoverThisOne:possible]): remove the
+       first 3 elements of the path array if the url returned by
+       baseURLInContext: returns a hostname.
+
+       * SoObjects/Mailer/SOGoMailFolder.m ([SOGoMailFolder
+       -_adjustOwner]): sharedFolderName and otherUsersFolderName may be
+       nil, in which case a crash happens when calling hasPrefix:.
+       ([SOGoMailFolder -_sharesACLs]): same as above.
+       ([SOGoMailFolder -otherUsersPathToFolder]): same as above. If
+       otherUsersFolderName is nil, we return nil.
+       ([SOGoMailFolder -httpURLForAdvisoryToUser:uid]): if we receive
+       nil from [self otherUsersPathToFolder], we return nil too.
+
 2007-06-01  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
        * SoObjects/SOGo/SOGoObject.m ([SOGoObject
index 0d2bab48b28029472c5285fd32d30a06c95de34b..1fb47e4d7424dc61fbe0008f8890a15aa88bc05f 100644 (file)
@@ -25,6 +25,7 @@
        "ModifyConfidentialRecords" = ( "Owner", "ConfidentialModifier" );
        "RespondToConfidentialRecords" = ( "Owner", "ConfidentialModifier", "ConfidentialResponder" );
        "Access Contents Information" = ( "Owner", "AuthorizedSubscriber" );
+       "Access Object" = ( "Owner", "AuthorizedSubscriber" );
       };
     };
     SOGoGroupAppointmentFolder = {
index d79cb68d6e17fcf9706cadcb59376e71cf772635..c257a3198b78d2f08f72c599f52a4f8e798988de 100644 (file)
@@ -65,21 +65,26 @@ static BOOL useAltNamespace = NO;
 - (void) _adjustOwner
 {
   SOGoMailAccount *mailAccount;
-  NSString *path;
+  NSString *path, *folder;
   NSArray *names;
 
   mailAccount = [self mailAccountFolder];
   path = [[self imap4Connection] imap4FolderNameForURL: [self imap4URL]];
 
-  if ([path hasPrefix: [mailAccount sharedFolderName]])
-    owner = @"anyone";
-  else if ([path hasPrefix: [mailAccount otherUsersFolderName]])
+  folder = [mailAccount sharedFolderName];
+  if (folder && [path hasPrefix: folder])
+    [self setOwner: @"anyone"];
+  else
     {
-      names = [path componentsSeparatedByString: @"/"];
-      if ([names count] > 1)
-       owner = [names objectAtIndex: 1];
-      else
-       owner = @"anyone";
+      folder = [mailAccount otherUsersFolderName];
+      if (folder && [path hasPrefix: folder])
+       {
+         names = [path componentsSeparatedByString: @"/"];
+         if ([names count] > 1)
+           [self setOwner: [names objectAtIndex: 1]];
+         else
+           [self setOwner: @"anyone"];
+       }
     }
 }
 
@@ -525,23 +530,28 @@ static BOOL useAltNamespace = NO;
 {
   NSMutableArray *acls;
   SOGoMailAccount *mailAccount;
-  NSString *path;
-  NSArray *names;
-  unsigned int count;
+  NSString *path, *folder;
+//   NSArray *names;
+//   unsigned int count;
 
   acls = [NSMutableArray array];
 
   mailAccount = [self mailAccountFolder];
   path = [[self imap4Connection] imap4FolderNameForURL: [self imap4URL]];
-  names = [path componentsSeparatedByString: @"/"];
-  count = [names count];
+//   names = [path componentsSeparatedByString: @"/"];
+//   count = [names count];
 
-  if ([path hasPrefix: [mailAccount sharedFolderName]])
-    [acls addObject: SOGoRole_ObjectViewer];
-  else if ([path hasPrefix: [mailAccount otherUsersFolderName]])
+  folder = [mailAccount sharedFolderName];
+  if (folder && [path hasPrefix: folder])
     [acls addObject: SOGoRole_ObjectViewer];
   else
-    [acls addObject: SoRole_Owner];
+    {
+      folder = [mailAccount otherUsersFolderName];
+      if (folder && [path hasPrefix: folder])
+       [acls addObject: SOGoRole_ObjectViewer];
+      else
+       [acls addObject: SoRole_Owner];
+    }
 
   return acls;
 }
@@ -610,14 +620,22 @@ static BOOL useAltNamespace = NO;
   sharedFolders = [account sharedFolderName];
 
   selfPath = [[self imap4URL] path];
-  if ([selfPath hasPrefix: [NSString stringWithFormat: @"/%@", otherUsers]]
-      || [selfPath hasPrefix:
-                    [NSString stringWithFormat: @"/%@", sharedFolders]])
+  if ((otherUsers
+       && [selfPath hasPrefix:
+                     [NSString stringWithFormat: @"/%@", otherUsers]])
+      || (sharedFolders
+         && [selfPath hasPrefix:
+                        [NSString stringWithFormat: @"/%@", sharedFolders]]))
     userPath = selfPath;
   else
-    userPath = [NSString stringWithFormat: @"/%@/%@%@",
-                        [otherUsers stringByEscapingURL],
-                        owner, selfPath];
+    {
+      if (otherUsers)
+       userPath = [NSString stringWithFormat: @"/%@/%@%@",
+                            [otherUsers stringByEscapingURL],
+                            owner, selfPath];
+      else
+       userPath = nil;
+    }
 
   return userPath;
 }
@@ -625,13 +643,19 @@ static BOOL useAltNamespace = NO;
 - (NSString *) httpURLForAdvisoryToUser: (NSString *) uid;
 {
   SOGoUser *user;
+  NSString *otherUsersPath, *url;
 
   user = [SOGoUser userWithLogin: uid roles: nil];
+  otherUsersPath = [self otherUsersPathToFolder];
+  if (otherUsersPath)
+    url = [NSString stringWithFormat: @"%@/%@%@",
+                   [self soURLToBaseContainerForUser: uid],
+                   [user primaryIMAP4AccountString],
+                   otherUsersPath];
+  else
+    url = nil;
 
-  return [NSString stringWithFormat: @"%@/%@%@",
-                  [self soURLToBaseContainerForUser: uid],
-                  [user primaryIMAP4AccountString],
-                  [self otherUsersPathToFolder]];
+  return url;
 }
 
 - (NSString *) resourceURLForAdvisoryToUser: (NSString *) uid;
index 46fffc69711f763e2e411bfba1491a5842ac44be..33d660174584446769bbd4ff5faf338c7221eb08 100644 (file)
@@ -828,6 +828,12 @@ static BOOL kontactGroupDAV = YES;
   baseURL = [[self baseURLInContext: context] stringByUnescapingURL];
   path = [NSMutableArray arrayWithArray: [baseURL componentsSeparatedByString:
                                                    @"/"]];
+  if ([baseURL hasPrefix: @"http"])
+    {
+      [path removeObjectAtIndex: 2];
+      [path removeObjectAtIndex: 1];
+      [path removeObjectAtIndex: 0];
+    }
   urlMethod = [path objectAtIndex: 2];
   if (![urlMethod isEqualToString: expected])
     {
index 78a146e5ced754485645efcf018952bfd740ddef..40cc8d0bb4eef5cfd1afd18d2b25c0b9f5574253 100644 (file)
@@ -86,6 +86,7 @@
 {
   NSMutableString *url;
 
+#warning the url returned by SOGoMail may be empty, we need to handle that
   url
     = [NSMutableString stringWithString:
                         [aclObject httpURLForAdvisoryToUser: recipientUID]];