From 786d7a1558aee91e7075a01986a888ace8a8c26e Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 1 Jun 2010 18:48:14 +0000 Subject: [PATCH] Monotone-Parent: a5bfd93a503f6042740a0ab88ca339c566d81c1f Monotone-Revision: e5e3e8aeac9b5235e537766deabadd79882c8c99 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-06-01T18:48:14 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 4 ++++ SoObjects/SOGo/SOGoUserManager.m | 28 +++++++++++++++++++++++++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 721f8b14c..1ad3407f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2010-06-01 Wolfgang Sourdeau + * SoObjects/SOGo/SOGoUserManager.m + (-contactInfosForUserWithUIDorEmail:): return a fixed dictionary + of information for uid = "anonymous". + * Tests/Integration/test-*.py: take the API changes in webdavlib.py into accounts with regards to XPath queries. diff --git a/SoObjects/SOGo/SOGoUserManager.m b/SoObjects/SOGo/SOGoUserManager.m index 9ade70d4f..7414d4e03 100644 --- a/SoObjects/SOGo/SOGoUserManager.m +++ b/SoObjects/SOGo/SOGoUserManager.m @@ -593,17 +593,39 @@ forLogin: key]; } +- (NSMutableDictionary *) _contactInfosForAnonymous +{ + static NSMutableDictionary *user = nil; + + if (!user) + { + user = [[NSMutableDictionary alloc] initWithCapacity: 7]; + [user setObject: [NSArray arrayWithObject: @"anonymous"] + forKey: @"emails"]; + [user setObject: @"Public User" forKey: @"cn"]; + [user setObject: @"anonymous" forKey: @"c_uid"]; + [user setObject: @"" forKey: @"c_domain"]; + [user setObject: [NSNumber numberWithBool: YES] + forKey: @"CalendarAccess"]; + [user setObject: [NSNumber numberWithBool: NO] + forKey: @"MailAccess"]; + } + + return user; +} + - (NSDictionary *) contactInfosForUserWithUIDorEmail: (NSString *) uid { - NSMutableDictionary *currentUser, *contactInfos; + NSMutableDictionary *currentUser; NSString *aUID, *jsonUser; BOOL newUser; - if ([uid length] > 0) + if ([uid isEqualToString: @"anonymous"]) + currentUser = [self _contactInfosForAnonymous]; + else if ([uid length] > 0) { // Remove the "@" prefix used to identified groups in the ACL tables. aUID = [uid hasPrefix: @"@"] ? [uid substringFromIndex: 1] : uid; - contactInfos = [NSMutableDictionary dictionary]; jsonUser = [[SOGoCache sharedCache] userAttributesForLogin: aUID]; currentUser = [NSMutableDictionary dictionaryWithJSONString: jsonUser]; if (!([currentUser objectForKey: @"emails"]