]> err.no Git - scalable-opengroupware.org/commitdiff
git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1286 d1b88da0-ebda-0310...
authorwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 30 Nov 2007 16:45:46 +0000 (16:45 +0000)
committerwolfgang <wolfgang@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 30 Nov 2007 16:45:46 +0000 (16:45 +0000)
ChangeLog
SoObjects/SOGo/SOGoGCSFolder.m
SoObjects/SOGo/SOGoParentFolder.m

index f75b25b430527f11e1d29a2c612bf4162855d130..9f43ee5ef900be8056acd4f957c12dbc1b255a3f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2007-11-30  Wolfgang Sourdeau  <wsourdeau@inverse.ca>
 
+       * SoObjects/SOGo/SOGoParentFolder.m ([SOGoParentFolder
+       -appendSubscribedSources]): don't include sources for which we
+       don't have the SOGoPerm_AccessObject permission.
+
        * SoObjects/SOGo/NSCalendarDate+SOGo.m ([NSCalendarDate
        -rfc822DateString]): we want positive timezones to be specified
        with a leading "+" too.
index 2e0a1c9c64fc207568e49d7ca2f0dfe91c1ec9d8..69e2a35614a65fd86413972b5f8f55405b3e3924 100644 (file)
@@ -93,7 +93,6 @@ static NSString *defaultUserID = @"<default>";
       ocsPath = nil;
       ocsFolder = nil;
       aclCache = [NSMutableDictionary new];
-      [self _fetchDisplayName];
     }
 
   return self;
@@ -104,7 +103,6 @@ static NSString *defaultUserID = @"<default>";
   [ocsFolder release];
   [ocsPath release];
   [aclCache release];
-  [displayName release];
   [super dealloc];
 }
 
@@ -116,23 +114,25 @@ static NSString *defaultUserID = @"<default>";
   NSDictionary *ownerIdentity;
 
   primaryDN = [row objectForKey: @"c_foldername"];
-  displayName = [NSMutableString string];
-  if ([primaryDN isEqualToString: [container defaultFolderName]])
-    [displayName appendString: [self labelForKey: primaryDN]];
-  else
-    [displayName appendString: primaryDN];
-
-  currentLogin = [[context activeUser] login];
-  ownerLogin = [self ownerInContext: context];
-  if (![currentLogin isEqualToString: ownerLogin])
+  if ([primaryDN length])
     {
-      ownerIdentity = [[SOGoUser userWithLogin: ownerLogin roles: nil]
-                       primaryIdentity];
-      [displayName
-       appendString: [ownerIdentity keysWithFormat:
-                                      @" (%{fullName} <%{email}>)"]];
+      displayName = [NSMutableString new];
+      if ([primaryDN isEqualToString: [container defaultFolderName]])
+       [displayName appendString: [self labelForKey: primaryDN]];
+      else
+       [displayName appendString: primaryDN];
+
+      currentLogin = [[context activeUser] login];
+      ownerLogin = [self ownerInContext: context];
+      if (![currentLogin isEqualToString: ownerLogin])
+       {
+         ownerIdentity = [[SOGoUser userWithLogin: ownerLogin roles: nil]
+                           primaryIdentity];
+         [displayName
+           appendString: [ownerIdentity keysWithFormat:
+                                          @" (%{fullName} <%{email}>)"]];
+       }
     }
-  [displayName retain];
 }
 
 - (void) _fetchDisplayName
@@ -166,6 +166,9 @@ static NSString *defaultUserID = @"<default>";
 
 - (NSString *) displayName
 {
+  if (!displayName)
+    [self _fetchDisplayName];
+
   return displayName;
 }
 
index a0d7616a6c1d9a22983a3c30a8be9a73e68df650..fb27adcb3bc87df0dc069ecbb99c960eab16c70e 100644 (file)
@@ -25,6 +25,7 @@
 #import <Foundation/NSUserDefaults.h>
 
 #import <NGObjWeb/NSException+HTTP.h>
+#import <NGObjWeb/SoSecurityManager.h>
 #import <NGObjWeb/WOContext+SoObjects.h>
 #import <GDLContentStore/GCSChannelManager.h>
 #import <GDLContentStore/GCSFolderManager.h>
 
 #import "SOGoParentFolder.h"
 
+static SoSecurityManager *sm = nil;
+
 @implementation SOGoParentFolder
 
++ (void) initialize
+{
+  if (!sm)
+    sm = [SoSecurityManager sharedSecurityManager];
+}
+
 - (id) init
 {
   if ((self = [super init]))
 #warning TO BE IMPLEMENTED SOON FIXME
 }
 
+- (void) _appendSubscribedSource: (NSString *) sourceKey
+{
+  SOGoGCSFolder *subscribedFolder;
+
+  subscribedFolder
+    = [subFolderClass folderWithSubscriptionReference: sourceKey
+                     inContainer: self];
+  if (subscribedFolder
+      && ![sm validatePermission: SOGoPerm_AccessObject
+             onObject: subscribedFolder
+             inContext: context])
+    [subFolders setObject: subscribedFolder
+               forKey: [subscribedFolder nameInContainer]];
+  else
+    [self _removeSubscribedSource: sourceKey];
+}
+
 - (void) appendSubscribedSources
 {
   NSArray *subscribedReferences;
   NSUserDefaults *settings;
   NSEnumerator *allKeys;
   NSString *currentKey;
-  SOGoGCSFolder *subscribedFolder;
 
   settings = [[context activeUser] userSettings];
   subscribedReferences = [[settings objectForKey: nameInContainer]
   if ([subscribedReferences isKindOfClass: [NSArray class]])
     {
       allKeys = [subscribedReferences objectEnumerator];
-      currentKey = [allKeys nextObject];
-      while (currentKey)
-       {
-         subscribedFolder
-           = [subFolderClass folderWithSubscriptionReference: currentKey
-                             inContainer: self];
-         if (subscribedFolder)
-           [subFolders setObject: subscribedFolder
-                       forKey: [subscribedFolder nameInContainer]];
-         else
-           [self _removeSubscribedSource: currentKey];
-         currentKey = [allKeys nextObject];
-       }
+      while ((currentKey = [allKeys nextObject]))
+       [self _appendSubscribedSource: currentKey];
     }
 }