From 044a29c178f7cea1196831f65bfa81ddd27fb398 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 2 Jun 2010 16:37:43 +0000 Subject: [PATCH] Monotone-Parent: be540f76fdae4a96eb16cea471d65d8da30b9428 Monotone-Revision: 3c3b185ac78cbde20c55f90c27b4f32909f9fdbf Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-06-02T16:37:43 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++++ SoObjects/Contacts/SOGoContactFolders.m | 27 ++++++++++++++++--------- 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3ad63ee74..7dd7a7f0e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-06-02 Wolfgang Sourdeau + * SoObjects/Contacts/SOGoContactFolders.m (-appendSystemSources): + we now add public sources to the list of folders if and only if + the active user is the owner of the current parent folder. + * SoObjects/SOGo/SOGoWebAuthenticator.m (-userInContext): if the returned user has the login "anonymous", we return a corresponding instance of SOGoUser to make sure methods are never invoked on diff --git a/SoObjects/Contacts/SOGoContactFolders.m b/SoObjects/Contacts/SOGoContactFolders.m index 105e6149e..98197dfa6 100644 --- a/SoObjects/Contacts/SOGoContactFolders.m +++ b/SoObjects/Contacts/SOGoContactFolders.m @@ -58,18 +58,25 @@ NSEnumerator *sourceIDs; NSString *currentSourceID, *srcDisplayName, *domain; SOGoContactSourceFolder *currentFolder; + SOGoUser *currentUser; - domain = [[context activeUser] domain]; - um = [SOGoUserManager sharedUserManager]; - sourceIDs = [[um addressBookSourceIDsInDomain: domain] objectEnumerator]; - while ((currentSourceID = [sourceIDs nextObject])) + currentUser = [context activeUser]; + if (activeUserIsOwner + || [[currentUser login] + isEqualToString: [self ownerInContext: context]]) { - srcDisplayName = [um displayNameForSourceWithID: currentSourceID]; - currentFolder = [SOGoContactSourceFolder folderWithName: currentSourceID - andDisplayName: srcDisplayName - inContainer: self]; - [currentFolder setSource: [um sourceWithID: currentSourceID]]; - [subFolders setObject: currentFolder forKey: currentSourceID]; + domain = [currentUser domain]; + um = [SOGoUserManager sharedUserManager]; + sourceIDs = [[um addressBookSourceIDsInDomain: domain] objectEnumerator]; + while ((currentSourceID = [sourceIDs nextObject])) + { + srcDisplayName = [um displayNameForSourceWithID: currentSourceID]; + currentFolder = [SOGoContactSourceFolder folderWithName: currentSourceID + andDisplayName: srcDisplayName + inContainer: self]; + [currentFolder setSource: [um sourceWithID: currentSourceID]]; + [subFolders setObject: currentFolder forKey: currentSourceID]; + } } return nil;