diff --git a/ChangeLog b/ChangeLog index c626e6580..4f3c6f7f0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2009-09-25 Ludovic Marcotte + + * Renamed SoObjects/Contacts/SOGoContactLDAPFolder to + SoObjects/Contacts/SOGoContactSourceFolder + * Renamed SoObjects/SOGo/LDAPUserManager to + SoObjects/SOGo/SOGoserManager.m + * Added SoObjects/SOGo/SOGoSource.h and + SoObjects/SOGo/SQLSource.{h,m} + We now support authentication and address book sources + coming from a SQL database. This can be used concurrently + with LDAP sources. Modified many classes to reflect this + change. + 2009-09-24 Cyril Robert * SoObjects/Appointments/SOGoAppointmentFolder.m (bareFetchFields:): Handled diff --git a/SoObjects/Appointments/SOGoAppointmentFolder.m b/SoObjects/Appointments/SOGoAppointmentFolder.m index d9cd1c089..6dcaa6007 100644 --- a/SoObjects/Appointments/SOGoAppointmentFolder.m +++ b/SoObjects/Appointments/SOGoAppointmentFolder.m @@ -57,7 +57,7 @@ #import #import #import -#import +#import #import #import #import @@ -2873,7 +2873,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir { /* Note: can return NSNull objects in the array! */ NSMutableArray *uids; - LDAPUserManager *um; + SOGoUserManager *um; unsigned i, count; iCalPerson *person; NSString *email; @@ -2883,7 +2883,7 @@ firstInstanceCalendarDateRange: (NGCalendarDateRange *) fir { count = [_persons count]; uids = [NSMutableArray arrayWithCapacity:count + 1]; - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; for (i = 0; i < count; i++) { diff --git a/SoObjects/Appointments/SOGoAppointmentObject.m b/SoObjects/Appointments/SOGoAppointmentObject.m index b8f0f7965..6cbc3dc5a 100644 --- a/SoObjects/Appointments/SOGoAppointmentObject.m +++ b/SoObjects/Appointments/SOGoAppointmentObject.m @@ -38,7 +38,7 @@ #import #import -#import +#import #import #import #import @@ -971,7 +971,7 @@ BOOL isUpdate, hasChanged; elements = [NSMutableArray array]; - ownerUID = [[LDAPUserManager sharedUserManager] + ownerUID = [[SOGoUserManager sharedUserManager] getUIDForEmail: originator]; eventOwner = [self iCalPersonWithUID: ownerUID]; emailEvent = [self component: NO secure: NO]; @@ -1138,7 +1138,7 @@ elements = [NSMutableArray array]; - ownerUID = [[LDAPUserManager sharedUserManager] + ownerUID = [[SOGoUserManager sharedUserManager] getUIDForEmail: originator]; event = [self component: NO secure: NO]; recipientsEnum = [recipients objectEnumerator]; @@ -1272,7 +1272,7 @@ elements = [NSMutableArray array]; event = [self component: NO secure: NO]; [[event parent] setMethod: @""]; - ownerUser = [SOGoUser userWithLogin: [[LDAPUserManager sharedUserManager] + ownerUser = [SOGoUser userWithLogin: [[SOGoUserManager sharedUserManager] getUIDForEmail: originator]]; attendee = [event findParticipant: ownerUser]; eventUID = [event uid]; diff --git a/SoObjects/Appointments/SOGoAptMailReceipt.m b/SoObjects/Appointments/SOGoAptMailReceipt.m index 81beab532..0d8e8c5b5 100644 --- a/SoObjects/Appointments/SOGoAptMailReceipt.m +++ b/SoObjects/Appointments/SOGoAptMailReceipt.m @@ -27,13 +27,13 @@ #import #import -#import +#import #import #import #import "SOGoAptMailReceipt.h" -static LDAPUserManager *um = nil; +static SOGoUserManager *um = nil; @implementation SOGoAptMailReceipt @@ -41,7 +41,7 @@ static LDAPUserManager *um = nil; + (void) initialize { if (!um) - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; } - (id) init diff --git a/SoObjects/Appointments/SOGoCalendarComponent.m b/SoObjects/Appointments/SOGoCalendarComponent.m index 57e77c0cf..08c1a9822 100644 --- a/SoObjects/Appointments/SOGoCalendarComponent.m +++ b/SoObjects/Appointments/SOGoCalendarComponent.m @@ -42,7 +42,7 @@ #import #import -#import +#import #import #import #import @@ -590,7 +590,7 @@ static inline BOOL _occurenceHasID (iCalRepeatableEntityObject *occurence, NSStr { NSString *uid; - uid = [[LDAPUserManager sharedUserManager] getUIDForEmail: email]; + uid = [[SOGoUserManager sharedUserManager] getUIDForEmail: email]; return [[SOGoUser userWithLogin: uid] timeZone]; } @@ -926,10 +926,10 @@ static inline BOOL _occurenceHasID (iCalRepeatableEntityObject *occurence, NSStr - (iCalPerson *) iCalPersonWithUID: (NSString *) uid { iCalPerson *person; - LDAPUserManager *um; + SOGoUserManager *um; NSDictionary *contactInfos; - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; contactInfos = [um contactInfosForUserWithUIDorEmail: uid]; person = [iCalPerson new]; diff --git a/SoObjects/Appointments/SOGoFreeBusyObject.m b/SoObjects/Appointments/SOGoFreeBusyObject.m index bb30b681f..c711b48c4 100644 --- a/SoObjects/Appointments/SOGoFreeBusyObject.m +++ b/SoObjects/Appointments/SOGoFreeBusyObject.m @@ -32,7 +32,7 @@ #import #import -#import +#import #import #import @@ -74,10 +74,10 @@ static unsigned int freebusyRangeEnd = 0; - (iCalPerson *) iCalPersonWithUID: (NSString *) uid { iCalPerson *person; - LDAPUserManager *um; + SOGoUserManager *um; NSDictionary *contactInfos; - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; contactInfos = [um contactInfosForUserWithUIDorEmail: uid]; /* iCal.app compatibility: diff --git a/SoObjects/Appointments/iCalEvent+SOGo.h b/SoObjects/Appointments/iCalEvent+SOGo.h index 134014ca9..6f82ca22a 100644 --- a/SoObjects/Appointments/iCalEvent+SOGo.h +++ b/SoObjects/Appointments/iCalEvent+SOGo.h @@ -1,6 +1,6 @@ /* iCalEvent+SOGo.h - this file is part of SOGo * - * Copyright (C) 2007 Inverse inc. + * Copyright (C) 2007-2009 Inverse inc. * * Author: Wolfgang Sourdeau * diff --git a/SoObjects/Appointments/iCalPerson+SOGo.h b/SoObjects/Appointments/iCalPerson+SOGo.h index 9b9b4bf7b..0d5c5be4d 100644 --- a/SoObjects/Appointments/iCalPerson+SOGo.h +++ b/SoObjects/Appointments/iCalPerson+SOGo.h @@ -1,6 +1,6 @@ /* iCalPerson+SOGo.h - this file is part of SOGo * - * Copyright (C) 2007-2008 Inverse inc. + * Copyright (C) 2007-2009 Inverse inc. * * Author: Wolfgang Sourdeau * @@ -25,8 +25,6 @@ #import -#import - @class NSString; @interface iCalPerson (SOGoExtension) diff --git a/SoObjects/Appointments/iCalPerson+SOGo.m b/SoObjects/Appointments/iCalPerson+SOGo.m index 00c6d1d5f..724b9df70 100644 --- a/SoObjects/Appointments/iCalPerson+SOGo.m +++ b/SoObjects/Appointments/iCalPerson+SOGo.m @@ -1,6 +1,6 @@ /* iCalPerson+SOGo.m - this file is part of SOGo * - * Copyright (C) 2007-2008 Inverse inc. + * Copyright (C) 2007-2009 Inverse inc. * * Author: Wolfgang Sourdeau * @@ -21,10 +21,11 @@ */ #import +#import #import "iCalPerson+SOGo.h" -static LDAPUserManager *um = nil; +static SOGoUserManager *um = nil; @implementation iCalPerson (SOGoExtension) @@ -45,7 +46,7 @@ static LDAPUserManager *um = nil; - (NSString *) uid { if (!um) - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; return [um getUIDForEmail: [self rfc822Email]]; } diff --git a/SoObjects/Contacts/GNUmakefile b/SoObjects/Contacts/GNUmakefile index 4d48263be..15eb49499 100644 --- a/SoObjects/Contacts/GNUmakefile +++ b/SoObjects/Contacts/GNUmakefile @@ -17,7 +17,7 @@ Contacts_OBJC_FILES = \ SOGoContactGCSList.m \ SOGoContactGCSFolder.m \ SOGoContactLDIFEntry.m \ - SOGoContactLDAPFolder.m \ + SOGoContactSourceFolder.m \ SOGoUserFolder+Contacts.m \ Contacts_RESOURCE_FILES += \ diff --git a/SoObjects/Contacts/SOGoContactFolders.m b/SoObjects/Contacts/SOGoContactFolders.m index c2330347f..3bedcc759 100644 --- a/SoObjects/Contacts/SOGoContactFolders.m +++ b/SoObjects/Contacts/SOGoContactFolders.m @@ -32,10 +32,10 @@ #import #import -#import +#import #import "SOGoContactGCSFolder.h" -#import "SOGoContactLDAPFolder.h" +#import "SOGoContactSourceFolder.h" #import "SOGoContactFolders.h" @implementation SOGoContactFolders @@ -52,20 +52,20 @@ - (NSException *) appendSystemSources { - LDAPUserManager *um; + SOGoUserManager *um; NSEnumerator *sourceIDs; NSString *currentSourceID, *srcDisplayName; - SOGoContactLDAPFolder *currentFolder; + SOGoContactSourceFolder *currentFolder; - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; sourceIDs = [[um addressBookSourceIDs] objectEnumerator]; while ((currentSourceID = [sourceIDs nextObject])) { srcDisplayName = [um displayNameForSourceWithID: currentSourceID]; - currentFolder = [SOGoContactLDAPFolder folderWithName: currentSourceID - andDisplayName: srcDisplayName - inContainer: self]; - [currentFolder setLDAPSource: [um sourceWithID: currentSourceID]]; + currentFolder = [SOGoContactSourceFolder folderWithName: currentSourceID + andDisplayName: srcDisplayName + inContainer: self]; + [currentFolder setSource: [um sourceWithID: currentSourceID]]; [subFolders setObject: currentFolder forKey: currentSourceID]; } diff --git a/SoObjects/Contacts/SOGoContactGCSFolder.m b/SoObjects/Contacts/SOGoContactGCSFolder.m index 507943466..5873d0583 100644 --- a/SoObjects/Contacts/SOGoContactGCSFolder.m +++ b/SoObjects/Contacts/SOGoContactGCSFolder.m @@ -53,21 +53,6 @@ @implementation SOGoContactGCSFolder -/* name lookup */ - -//- (id ) lookupContactWithId: (NSString *) recordId -//{ -// SOGoContactGCSEntry *contact; -// -// if ([recordId length] > 0) -// contact = [SOGoContactGCSEntry objectWithName: recordId -// inContainer: self]; -// else -// contact = nil; -// -// return contact; -//} - - (Class) objectClassForContent: (NSString *) content { CardGroup *cardEntry; @@ -171,44 +156,6 @@ return obj; } -// - (id) lookupName: (NSString *) _key -// inContext: (WOContext *) _ctx -// acquire: (BOOL) _flag -// { -// id obj; -// BOOL isPut; - -// isPut = NO; -// obj = [super lookupName:_key inContext:_ctx acquire:NO]; - -// if (!obj) -// { -// if ([[[_ctx request] method] isEqualToString: @"PUT"]) -// { -// if ([_key isEqualToString: @"PUT"]) -// isPut = YES; -// else - -// obj = [SOGoContactGCSEntry objectWithName: _key -// inContainer: self]; -// } -// else -// obj = [self lookupContactWithId: _key]; -// } -// if (!(obj || isPut)) -// obj = [NSException exceptionWithHTTPStatus:404 /* Not Found */]; - -// #if 0 -// if ([[self ocsFolder] versionOfContentWithName:_key]) -// #endif -// return [self contactWithName:_key inContext:_ctx]; -// } - -// /* return 404 to stop acquisition */ -// return obj; -// } - -/* fetching */ - (EOQualifier *) _qualifierForFilter: (NSString *) filter { NSString *qs; @@ -304,8 +251,6 @@ } else records = nil; - // else - //[self errorWithFormat:@"(%s): fetch failed!", __PRETTY_FUNCTION__]; [self debugWithFormat:@"fetched %i records.", [records count]]; return records; @@ -387,7 +332,7 @@ NSComparisonResult comparison; if ([NSStringFromClass([otherFolder class]) - isEqualToString: @"SOGoContactLDAPFolder"]) + isEqualToString: @"SOGoContactSourceFolder"]) comparison = NSOrderedAscending; else comparison = [super compare: otherFolder]; diff --git a/SoObjects/Contacts/SOGoContactLDIFEntry.m b/SoObjects/Contacts/SOGoContactLDIFEntry.m index 79a951d4e..3904b55fa 100644 --- a/SoObjects/Contacts/SOGoContactLDIFEntry.m +++ b/SoObjects/Contacts/SOGoContactLDIFEntry.m @@ -82,11 +82,11 @@ { NSString *info; - info = [ldifEntry objectForKey: @"telephoneNumber"]; + info = [ldifEntry objectForKey: @"telephonenumber"]; if (info) [vCard addTel: info types: [NSArray arrayWithObjects: @"work", @"voice", @"pref", nil]]; - info = [ldifEntry objectForKey: @"homePhone"]; + info = [ldifEntry objectForKey: @"homephone"]; if (info) [vCard addTel: info types: [NSArray arrayWithObjects: @"home", @"voice", nil]]; @@ -123,7 +123,7 @@ [vcard setVClass: @"PUBLIC"]; [vcard setProdID: @"-//Inverse inc./SOGo 1.0//EN"]; [vcard setProfile: @"vCard"]; - info = [ldifEntry objectForKey: @"displayName"]; + info = [ldifEntry objectForKey: @"displayname"]; if (!(info && [info length] > 0)) info = [ldifEntry objectForKey: @"cn"]; [vcard setFn: info]; @@ -131,14 +131,14 @@ if (!surname) surname = [ldifEntry objectForKey: @"surname"]; [vcard setNWithFamily: surname - given: [ldifEntry objectForKey: @"givenName"] + given: [ldifEntry objectForKey: @"givenname"] additional: nil prefixes: nil suffixes: nil]; info = [ldifEntry objectForKey: @"title"]; if (info) [vcard setTitle: info]; - info = [ldifEntry objectForKey: @"mozillaNickname"]; + info = [ldifEntry objectForKey: @"mozillanickname"]; if (info) [vcard setNickname: info]; @@ -162,7 +162,7 @@ [self _setPhonesOfVCard: vcard]; streetAddress = [ldifEntry objectForKey: @"street"]; - if (!streetAddress) streetAddress = [ldifEntry objectForKey: @"streetAddress"]; + if (!streetAddress) streetAddress = [ldifEntry objectForKey: @"streetaddress"]; location = [ldifEntry objectForKey: @"l"]; if (!location) location = [ldifEntry objectForKey: @"locality"]; @@ -170,7 +170,7 @@ region = [ldifEntry objectForKey: @"st"]; if (!region) region = [ldifEntry objectForKey: @"region"]; - postalCode = [ldifEntry objectForKey: @"postalCode"]; + postalCode = [ldifEntry objectForKey: @"postalcode"]; if (!postalCode) postalCode = [ldifEntry objectForKey: @"zip"]; country = [ldifEntry objectForKey: @"c"]; @@ -217,7 +217,7 @@ for (count = 1; count < 5; count++) { info = [ldifEntry objectForKey: - [NSString stringWithFormat: @"mozillaCustom%d", + [NSString stringWithFormat: @"mozillacustom%d", count]]; if (info) [vcard addChildWithTag: [NSString stringWithFormat: @"CUSTOM%d", diff --git a/SoObjects/Contacts/SOGoContactLDAPFolder.h b/SoObjects/Contacts/SOGoContactSourceFolder.h similarity index 76% rename from SoObjects/Contacts/SOGoContactLDAPFolder.h rename to SoObjects/Contacts/SOGoContactSourceFolder.h index 2389e7f8c..b58dd571f 100644 --- a/SoObjects/Contacts/SOGoContactLDAPFolder.h +++ b/SoObjects/Contacts/SOGoContactSourceFolder.h @@ -1,6 +1,6 @@ -/* SOGoContactLDAPFolder.h - this file is part of SOGo +/* SOGoContactSourceFolder.h - this file is part of SOGo * - * Copyright (C) 2006 Inverse inc. + * Copyright (C) 2006-2009 Inverse inc. * * Author: Wolfgang Sourdeau * @@ -20,19 +20,19 @@ * Boston, MA 02111-1307, USA. */ -#ifndef SOGOCONTACTLDAPFOLDER_H -#define SOGOCONTACTLDAPFOLDER_H +#ifndef SOGOCONTACTSOURCEFOLDER_H +#define SOGOCONTACTSOURCEFOLDER_H #import "SOGoContactFolder.h" #import "SOGoFolder+CardDAV.h" @class NSMutableDictionary; -@class LDAPSource; +#import "../SOGo/SOGoSource.h" -@interface SOGoContactLDAPFolder : SOGoFolder +@interface SOGoContactSourceFolder : SOGoFolder { - LDAPSource *ldapSource; + id source; NSMutableDictionary *entries; } @@ -42,9 +42,9 @@ - (id) initWithName: (NSString *) newName andDisplayName: (NSString *) newDisplayName inContainer: (id) newContainer; -- (void) setLDAPSource: (LDAPSource *) newLdapSource; +- (void) setSource: (id) newSource; @end -#endif /* SOGOCONTACTLDAPFOLDER_H */ +#endif /* SOGOCONTACTSOURCEFOLDER_H */ diff --git a/SoObjects/Contacts/SOGoContactLDAPFolder.m b/SoObjects/Contacts/SOGoContactSourceFolder.m similarity index 92% rename from SoObjects/Contacts/SOGoContactLDAPFolder.m rename to SoObjects/Contacts/SOGoContactSourceFolder.m index 917519811..0d9456972 100644 --- a/SoObjects/Contacts/SOGoContactLDAPFolder.m +++ b/SoObjects/Contacts/SOGoContactSourceFolder.m @@ -1,4 +1,4 @@ -/* SOGoContactLDAPFolder.m - this file is part of SOGo +/* SOGoContactSourceFolder.m - this file is part of SOGo * * Copyright (C) 2006-2009 Inverse inc. * @@ -40,14 +40,13 @@ #import #import -#import #import #import "SOGoContactLDIFEntry.h" -#import "SOGoContactLDAPFolder.h" +#import "SOGoContactSourceFolder.h" @class WOContext; -@implementation SOGoContactLDAPFolder +@implementation SOGoContactSourceFolder #warning this should be unified within SOGoFolder - (void) appendObject: (NSDictionary *) object @@ -111,7 +110,7 @@ if ((self = [super init])) { entries = nil; - ldapSource = nil; + source = nil; } return self; @@ -133,13 +132,13 @@ - (void) dealloc { [entries release]; - [ldapSource release]; + [source release]; [super dealloc]; } -- (void) setLDAPSource: (LDAPSource *) newLDAPSource +- (void) setSource: (id) newSource { - ASSIGN (ldapSource, newLDAPSource); + ASSIGN (source, newSource); } - (NSString *) groupDavResourceType @@ -166,17 +165,15 @@ inContext: (WOContext *) lookupContext acquire: (BOOL) acquire { - id obj; NSDictionary *ldifEntry; - - //NSLog (@"looking up name '%@'...", objectName); + id obj; /* first check attributes directly bound to the application */ obj = [super lookupName: objectName inContext: lookupContext acquire: NO]; if (!obj) { - ldifEntry = [ldapSource lookupContactEntry: objectName]; + ldifEntry = [source lookupContactEntry: objectName]; if (ldifEntry) obj = [SOGoContactLDIFEntry contactEntryWithName: objectName withLDIFEntry: ldifEntry @@ -190,7 +187,7 @@ - (NSArray *) toOneRelationshipKeys { - return [ldapSource allEntryIDs]; + return [source allEntryIDs]; } - (NSArray *) _flattenedRecords: (NSArray *) records @@ -218,7 +215,7 @@ [newRecord setObject: [oldRecord objectForKey: @"c_name"] forKey: @"c_name"]; - data = [oldRecord objectForKey: @"displayName"]; + data = [oldRecord objectForKey: @"displayname"]; if (!data) data = [oldRecord objectForKey: @"c_cn"]; if (!data) @@ -230,7 +227,7 @@ data = @""; [newRecord setObject: data forKey: @"c_mail"]; - data = [oldRecord objectForKey: @"nsAIMid"]; + data = [oldRecord objectForKey: @"nsaimid"]; if (![data length]) data = [oldRecord objectForKey: @"nscpaimscreenname"]; if (![data length]) @@ -242,15 +239,17 @@ data = @""; [newRecord setObject: data forKey: @"c_o"]; - data = [oldRecord objectForKey: @"telephoneNumber"]; + data = [oldRecord objectForKey: @"telephonenumber"]; if (![data length]) data = [oldRecord objectForKey: @"cellphone"]; if (![data length]) - data = [oldRecord objectForKey: @"homePhone"]; + data = [oldRecord objectForKey: @"homephone"]; if (![data length]) data = @""; [newRecord setObject: data forKey: @"c_telephonenumber"]; + // Custom attribute for group-lookups. See LDAPSource.m where + // it's set. data = [oldRecord objectForKey: @"isGroup"]; if (data) [newRecord setObject: data forKey: @"isGroup"]; @@ -281,7 +280,7 @@ if (filter && [filter length] > 0) { records = [self _flattenedRecords: - [ldapSource fetchContactsMatching: filter]]; + [source fetchContactsMatching: filter]]; ordering = [EOSortOrdering sortOrderingWithKey: sortKey selector: ((sortOrdering == NSOrderedDescending) diff --git a/SoObjects/Contacts/product.plist b/SoObjects/Contacts/product.plist index b7198aa1e..000e71486 100644 --- a/SoObjects/Contacts/product.plist +++ b/SoObjects/Contacts/product.plist @@ -20,7 +20,7 @@ SOGoContactGCSList = { superclass = "SOGoContentObject"; }; - SOGoContactLDAPFolder = { + SOGoContactSourceFolder = { superclass = "SOGoGCSFolder"; protectedBy = "Access Contents Information"; defaultRoles = { diff --git a/SoObjects/SOGo/GNUmakefile b/SoObjects/SOGo/GNUmakefile index c57eca0b8..6f359b925 100644 --- a/SoObjects/SOGo/GNUmakefile +++ b/SoObjects/SOGo/GNUmakefile @@ -23,8 +23,9 @@ SOGo_HEADER_FILES = \ SOGoParentFolder.h \ SOGoUserFolder.h \ \ - LDAPUserManager.h \ + SOGoUserManager.h \ LDAPSource.h \ + SQLSource.h \ SOGoUserDefaults.h \ SOGoDateFormatter.h \ SOGoPermissions.h \ @@ -76,8 +77,9 @@ SOGo_OBJC_FILES = \ \ SOGoDateFormatter.m \ SOGoPermissions.m \ - LDAPUserManager.m \ + SOGoUserManager.m \ LDAPSource.m \ + SQLSource.m \ SOGoUserDefaults.m \ iCalEntityObject+Utilities.m \ NSArray+DAV.m \ diff --git a/SoObjects/SOGo/LDAPSource.h b/SoObjects/SOGo/LDAPSource.h index 4a4e923c3..cff038319 100644 --- a/SoObjects/SOGo/LDAPSource.h +++ b/SoObjects/SOGo/LDAPSource.h @@ -25,12 +25,14 @@ #import +#include "SOGoSource.h" + @class NSDictionary; @class NSString; @class NGLdapConnection; @class NGLdapEntry; -@interface LDAPSource : NSObject +@interface LDAPSource : NSObject { NSString *sourceID; NSString *bindDN; diff --git a/SoObjects/SOGo/LDAPSource.m b/SoObjects/SOGo/LDAPSource.m index 691a4e550..697b55d39 100644 --- a/SoObjects/SOGo/LDAPSource.m +++ b/SoObjects/SOGo/LDAPSource.m @@ -32,7 +32,6 @@ #import #import -#import "LDAPUserManager.h" #import "NSArray+Utilities.h" #import "NSString+Utilities.h" @@ -68,16 +67,16 @@ static NSLock *lock; @"title", @"company", @"o", - @"displayName", + @"displayname", @"modifytimestamp", - @"mozillaHomeState", - @"mozillaHomeUrl", + @"mozillahomestate", + @"mozillahomeurl", @"homeurl", @"st", @"region", - @"mozillaCustom2", + @"mozillacustom2", @"custom2", - @"mozillaHomeCountryName", + @"mozillahomecountryname", @"description", @"notes", @"department", @@ -87,36 +86,36 @@ static NSLock *lock; @"mobile", @"cellphone", @"carphone", - @"mozillaCustom1", + @"mozillacustom1", @"custom1", - @"mozillaNickname", + @"mozillanickname", @"xmozillanickname", - @"mozillaWorkUrl", + @"mozillaworkurl", @"workurl", @"fax", - @"facsimileTelephoneNumber", - @"telephoneNumber", - @"mozillaHomeStreet", - @"mozillaSecondEmail", + @"facsimiletelephonenumber", + @"telephonenumber", + @"mozillahomestreet", + @"mozillasecondemail", @"xmozillasecondemail", - @"mozillaCustom4", + @"mozillacustom4", @"custom4", - @"nsAIMid", + @"nsaimid", @"nscpaimscreenname", @"street", - @"streetAddress", - @"postOfficeBox", - @"homePhone", + @"streetaddress", + @"postofficebox", + @"homephone", @"cn", @"commonname", - @"givenName", - @"mozillaHomePostalCode", - @"mozillaHomeLocalityName", - @"mozillaWorkStreet2", - @"mozillaUseHtmlMail", + @"givenname", + @"mozillahomepostalcode", + @"mozillahomelocalityname", + @"mozillaworkstreet2", + @"mozillausehtmlmail", @"xmozillausehtmlmail", - @"mozillaHomeStreet2", - @"postalCode", + @"mozillahomestreet2", + @"postalcode", @"zip", @"c", @"countryname", @@ -125,13 +124,13 @@ static NSLock *lock; @"mail", @"sn", @"surname", - @"mozillaCustom3", + @"mozillacustom3", @"custom3", @"l", @"locality", @"birthyear", - @"serialNumber", - @"calFBURL", @"proxyAddresses", + @"serialnumber", + @"calfburl", @"proxyaddresses", nil]; [commonSearchFields retain]; @@ -224,7 +223,7 @@ static NSLock *lock; ASSIGN (_filter, [udSource objectForKey: @"filter"]); ASSIGN (_scope, ([udSource objectForKey: @"scope"] ? [udSource objectForKey: @"scope"] - : @"sub")); + : (id)@"sub")); return self; } @@ -611,7 +610,7 @@ static NSLock *lock; NSMutableArray *emails; NSArray *allValues; - emails = [NSMutableArray new]; + emails = [[NSMutableArray alloc] init]; emailFields = [mailFields objectEnumerator]; while ((currentFieldName = [emailFields nextObject])) { @@ -667,34 +666,56 @@ static NSLock *lock; NSMutableDictionary *contactEntry; NSEnumerator *attributes; NSString *currentAttribute, *value; - NSArray *classes; + NSMutableArray *classes; + id o; contactEntry = [NSMutableDictionary dictionary]; [contactEntry setObject: [ldapEntry dn] forKey: @"dn"]; - classes = [ldapEntry objectClasses]; attributes = [[self _searchAttributes] objectEnumerator]; + // We get our objectClass attribute values. We lowercase + // everything for ease of search after. + o = [ldapEntry objectClasses]; + classes = nil; + + if (o) + { + int i, c; + + classes = [NSMutableArray arrayWithArray: o]; + c = [classes count]; + for (i = 0; i < c; i++) + [classes replaceObjectAtIndex: i + withObject: [[classes objectAtIndex: i] lowercaseString]]; + } + if (classes) { [contactEntry setObject: classes - forKey: @"objectClasses"]; + forKey: @"objectclasses"]; + // We check if our entry is a group. If so, we set the + // 'isGroup' custom attribute. if ([classes containsObject: @"group"] || - [classes containsObject: @"groupOfNames"] || - [classes containsObject: @"groupOfUniqueNames"] || - [classes containsObject: @"posixGroup"]) + [classes containsObject: @"groupofnames"] || + [classes containsObject: @"groupofuniquenames"] || + [classes containsObject: @"posixgroup"]) { [contactEntry setObject: [NSNumber numberWithInt: 1] forKey: @"isGroup"]; } } + while ((currentAttribute = [attributes nextObject])) { value = [[ldapEntry attributeWithName: currentAttribute] stringValueAtIndex: 0]; + + // It's important here to set our attributes' key in lowercase. if (value) - [contactEntry setObject: value forKey: currentAttribute]; + [contactEntry setObject: value forKey: [currentAttribute lowercaseString]]; } + value = [[ldapEntry attributeWithName: IDField] stringValueAtIndex: 0]; if (!value) value = @""; diff --git a/SoObjects/SOGo/SOGoDAVAuthenticator.m b/SoObjects/SOGo/SOGoDAVAuthenticator.m index 0288814fe..95fcb3417 100644 --- a/SoObjects/SOGo/SOGoDAVAuthenticator.m +++ b/SoObjects/SOGo/SOGoDAVAuthenticator.m @@ -28,7 +28,7 @@ #import #import -#import "LDAPUserManager.h" +#import "SOGoUserManager.h" #import "SOGoPermissions.h" #import "SOGoUser.h" @@ -78,11 +78,11 @@ password: (NSString *) _pwd { BOOL accept; - LDAPUserManager *um; + SOGoUserManager *um; if ([authMethod isEqualToString: @"LDAP"]) { - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; accept = [um checkLogin: _login andPassword: _pwd]; } else diff --git a/SoObjects/SOGo/SOGoGroup.m b/SoObjects/SOGo/SOGoGroup.m index dcd231222..0e54ef02d 100644 --- a/SoObjects/SOGo/SOGoGroup.m +++ b/SoObjects/SOGo/SOGoGroup.m @@ -51,7 +51,7 @@ #import #include "LDAPSource.h" -#include "LDAPUserManager.h" +#include "SOGoUserManager.h" #include "SOGoUser.h" #import @@ -117,12 +117,12 @@ if (!theValue) return nil; - allSources = [[LDAPUserManager sharedUserManager] sourceIDs]; + allSources = [[SOGoUserManager sharedUserManager] sourceIDs]; o = nil; for (i = 0; i < [allSources count]; i++) { - source = [[LDAPUserManager sharedUserManager] sourceWithID: [allSources objectAtIndex: i]]; + source = [[SOGoUserManager sharedUserManager] sourceWithID: [allSources objectAtIndex: i]]; entry = [source performSelector: theSelector withObject: theValue]; @@ -167,7 +167,7 @@ NSString *dn, *login; SOGoUser *user; NSArray *o; - LDAPUserManager *um; + SOGoUserManager *um; int i, c; array = [NSMutableArray array]; @@ -196,7 +196,7 @@ // We deal with a static group, let's add the members if (c) { - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; // We add members for whom we have their associated DN for (i = 0; i < [dns count]; i++) diff --git a/SoObjects/SOGo/SOGoObject.m b/SoObjects/SOGo/SOGoObject.m index cc8a856db..e508c6d9f 100644 --- a/SoObjects/SOGo/SOGoObject.m +++ b/SoObjects/SOGo/SOGoObject.m @@ -1,7 +1,7 @@ /* SOGoGCSFolder.m - this file is part of SOGo * * Copyright (C) 2004-2005 SKYRIX Software AG - * Copyright (C) 2006-2008 Inverse inc. + * Copyright (C) 2006-2009 Inverse inc. * * Author: Wolfgang Sourdeau * @@ -51,7 +51,6 @@ #import #import -#import "LDAPUserManager.h" #import "NSArray+Utilities.h" #import "NSCalendarDate+SOGo.h" #import "NSDictionary+Utilities.h" diff --git a/SoObjects/SOGo/SOGoProxyAuthenticator.m b/SoObjects/SOGo/SOGoProxyAuthenticator.m index 47686f63b..024e06a78 100644 --- a/SoObjects/SOGo/SOGoProxyAuthenticator.m +++ b/SoObjects/SOGo/SOGoProxyAuthenticator.m @@ -31,7 +31,6 @@ #import -#import "LDAPUserManager.h" #import "SOGoPermissions.h" #import "SOGoUser.h" diff --git a/SoObjects/SOGo/SOGoSource.h b/SoObjects/SOGo/SOGoSource.h new file mode 100644 index 000000000..d201e6d94 --- /dev/null +++ b/SoObjects/SOGo/SOGoSource.h @@ -0,0 +1,49 @@ +/* SOGoSource.h - this file is part of SOGo + * + * Copyright (C) 2009 Inverse inc. + * + * Author: Ludovic Marcotte + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef SOGOSOURCE_H +#define SOGOSOURCE_H + +#import + +@class NSDictionary; +@class NSString; + +@protocol SOGoSource + ++ (id) sourceFromUDSource: (NSDictionary *) udSource; + +- (id) initFromUDSource: (NSDictionary *) udSource; + +- (BOOL) checkLogin: (NSString *) login + andPassword: (NSString *) password; + +- (NSDictionary *) lookupContactEntry: (NSString *) theID; +- (NSDictionary *) lookupContactEntryWithUIDorEmail: (NSString *) entryID; + +- (NSArray *) allEntryIDs; +- (NSArray *) fetchContactsMatching: (NSString *) filter; +- (NSString *) sourceID; + +@end + +#endif /* SOGOSOURCE_H */ diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index 3745cd118..fc49e66b2 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -37,7 +37,7 @@ #import #import -#import "LDAPUserManager.h" +#import "SOGoUserManager.h" #import "NSArray+Utilities.h" #import "SOGoCache.h" #import "SOGoDateFormatter.h" @@ -259,7 +259,7 @@ _timeValue (NSString *key) roles: (NSArray *) newRoles trust: (BOOL) b { - LDAPUserManager *um; + SOGoUserManager *um; NSString *realUID; _defaults = nil; @@ -274,7 +274,7 @@ _timeValue (NSString *key) realUID = newLogin; else { - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; realUID = [[um contactInfosForUserWithUIDorEmail: newLogin] objectForKey: @"c_uid"]; } @@ -327,9 +327,9 @@ _timeValue (NSString *key) - (id) _fetchFieldForUser: (NSString *) field { NSDictionary *contactInfos; - LDAPUserManager *um; + SOGoUserManager *um; - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; contactInfos = [um contactInfosForUserWithUIDorEmail: login]; return [contactInfos objectForKey: field]; @@ -406,7 +406,7 @@ _timeValue (NSString *key) [self logWithFormat: @"'SOGoFallbackIMAP4Server' is not set"]; doSave = NO; } - if (![LDAPUserManager defaultMailDomainIsConfigured]) + if (![SOGoUserManager defaultMailDomainIsConfigured]) { [self logWithFormat: @"'SOGoDefaultMailDomain' is not set"]; doSave = NO; @@ -724,7 +724,7 @@ _timeValue (NSString *key) NSArray *mails; unsigned int count, max; - imapLogin = [[LDAPUserManager sharedUserManager] getImapLoginForUID: login]; + imapLogin = [[SOGoUserManager sharedUserManager] getImapLoginForUID: login]; imapServer = [self _fetchFieldForUser: @"c_imaphostname"]; if (!imapServer) imapServer = fallbackIMAP4Server; diff --git a/SoObjects/SOGo/SOGoUserFolder.m b/SoObjects/SOGo/SOGoUserFolder.m index cbc8c3d9e..40d5c9640 100644 --- a/SoObjects/SOGo/SOGoUserFolder.m +++ b/SoObjects/SOGo/SOGoUserFolder.m @@ -1,5 +1,6 @@ /* Copyright (C) 2004-2005 SKYRIX Software AG + Copyright (C) 2007-2009 Inverse inc. This file is part of OpenGroupware.org. @@ -51,7 +52,7 @@ #import "NSArray+Utilities.h" #import "NSDictionary+Utilities.h" -#import "LDAPUserManager.h" +#import "SOGoUserManager.h" #import "SOGoPermissions.h" #import "SOGoUser.h" #import "WORequest+SOGo.h" @@ -229,7 +230,7 @@ static NSString *LDAPContactInfoAttribute = nil; results = [NSMutableDictionary dictionary]; contacts - = [[LDAPUserManager sharedUserManager] fetchUsersMatching: uid]; + = [[SOGoUserManager sharedUserManager] fetchUsersMatching: uid]; enumerator = [contacts objectEnumerator]; while ((contact = [enumerator nextObject])) { @@ -328,13 +329,13 @@ static NSString *LDAPContactInfoAttribute = nil; { NSArray *users, *owners; NSString *ownerMatch; - LDAPUserManager *um; + SOGoUserManager *um; owners = [NSMutableArray array]; if (davOwnerMatch) { ownerMatch = [self _userFromDAVuser: davOwnerMatch]; - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; users = [[um fetchUsersMatching: ownerMatch] sortedArrayUsingSelector: @selector (caseInsensitiveDisplayNameCompare:)]; owners = [users objectsForKey: @"c_uid" notFoundMarker: nil]; @@ -391,7 +392,7 @@ static NSString *LDAPContactInfoAttribute = nil; - (NSString *) _davFetchUsersMatching: (NSString *) user { - LDAPUserManager *um; + SOGoUserManager *um; NSMutableString *fetch; NSDictionary *currentUser; NSString *field, *login; @@ -402,7 +403,7 @@ static NSString *LDAPContactInfoAttribute = nil; fetch = [NSMutableString string]; login = [[context activeUser] login]; - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; // We sort our array - this is pretty useful for the // SOGo Integrator extension, among other things. @@ -609,7 +610,7 @@ static NSString *LDAPContactInfoAttribute = nil; - (NSString *) davDisplayName { - return [[LDAPUserManager sharedUserManager] + return [[SOGoUserManager sharedUserManager] getCNForUID: nameInContainer]; } diff --git a/SoObjects/SOGo/LDAPUserManager.h b/SoObjects/SOGo/SOGoUserManager.h similarity index 88% rename from SoObjects/SOGo/LDAPUserManager.h rename to SoObjects/SOGo/SOGoUserManager.h index d938b65bb..0513b900f 100644 --- a/SoObjects/SOGo/LDAPUserManager.h +++ b/SoObjects/SOGo/SOGoUserManager.h @@ -1,4 +1,4 @@ -/* LDAPUserManager.h - this file is part of SOGo +/* SOGoUserManager.h - this file is part of SOGo * * Copyright (C) 2007-2009 Inverse inc. * @@ -20,8 +20,8 @@ * Boston, MA 02111-1307, USA. */ -#ifndef LDAPUSERMANAGER_H -#define LDAPUSERMANAGER_H +#ifndef SOGOUSERMANAGER_H +#define SOGOUSERMANAGER_H #import @@ -33,11 +33,11 @@ @class LDAPSource; -@interface LDAPUserManager : NSObject +@interface SOGoUserManager : NSObject { @private - NSMutableDictionary *sources; - NSMutableDictionary *sourcesMetadata; + NSMutableDictionary *_sources; + NSMutableDictionary *_sourcesMetadata; } + (id) sharedUserManager; @@ -67,4 +67,4 @@ @end -#endif /* LDAPUSERMANAGER_H */ +#endif /* SOGOUSERMANAGER_H */ diff --git a/SoObjects/SOGo/LDAPUserManager.m b/SoObjects/SOGo/SOGoUserManager.m similarity index 83% rename from SoObjects/SOGo/LDAPUserManager.m rename to SoObjects/SOGo/SOGoUserManager.m index 467f50b45..033178b56 100644 --- a/SoObjects/SOGo/LDAPUserManager.m +++ b/SoObjects/SOGo/SOGoUserManager.m @@ -1,4 +1,4 @@ -/* LDAPUserManager.m - this file is part of SOGo +/* SOGoUserManager.m - this file is part of SOGo * * Copyright (C) 2007-2009 Inverse inc. * @@ -29,10 +29,14 @@ #import #import -#import "NSArray+Utilities.h" -#import "LDAPSource.h" -#import "LDAPUserManager.h" -#import "SOGoCache.h" +#include "NSArray+Utilities.h" +#include "SOGoSource.h" +#include "SOGoUserManager.h" +#include "SOGoCache.h" +#include "SOGoSource.h" + +#include "LDAPSource.h" +#include "SQLSource.h" static NSString *defaultMailDomain = nil; static NSString *LDAPContactInfoAttribute = nil; @@ -43,7 +47,7 @@ static BOOL forceImapLoginWithEmail = NO; static NSLock *lock = nil; #endif -@implementation LDAPUserManager +@implementation SOGoUserManager + (void) initialize { @@ -97,17 +101,25 @@ static NSLock *lock = nil; - (void) _registerSource: (NSDictionary *) udSource { + NSString *sourceID, *value, *type; NSMutableDictionary *metadata; - LDAPSource *ldapSource; - NSString *sourceID, *value; + id ldapSource; + Class c; sourceID = [udSource objectForKey: @"id"]; - ldapSource = [LDAPSource sourceFromUDSource: udSource]; - if (sourceID) - [sources setObject: ldapSource forKey: sourceID]; + type = [udSource objectForKey: @"type"]; + + if (!type || [type caseInsensitiveCompare: @"ldap"] == NSOrderedSame) + c = [LDAPSource class]; else - [self errorWithFormat: @"id field missing in a LDAP source," - @" check the SOGoLDAPSources defaults"]; + c = [SQLSource class]; + + ldapSource = [c sourceFromUDSource: udSource]; + if (sourceID) + [_sources setObject: ldapSource forKey: sourceID]; + else + [self errorWithFormat: @"id field missing in an user source," + @" check the SOGoUserSources defaults"]; metadata = [NSMutableDictionary dictionary]; value = [udSource objectForKey: @"canAuthenticate"]; if (value) @@ -121,27 +133,46 @@ static NSLock *lock = nil; value = [udSource objectForKey: @"MailFieldNames"]; if (value) [metadata setObject: value forKey: @"MailFieldNames"]; - [sourcesMetadata setObject: metadata forKey: sourceID]; + [_sourcesMetadata setObject: metadata forKey: sourceID]; } -- (void) _prepareLDAPSourcesWithDefaults: (NSUserDefaults *) ud +- (void) _prepareSourcesWithDefaults: (NSUserDefaults *) ud { - id udSources; + id o, sources; unsigned int count, max; - sources = [NSMutableDictionary new]; - sourcesMetadata = [NSMutableDictionary new]; + _sources = [[NSMutableDictionary alloc] init]; + _sourcesMetadata = [[NSMutableDictionary alloc] init]; - udSources = [ud arrayForKey: @"SOGoLDAPSources"]; - - if (udSources && [udSources isKindOfClass: [NSArray class]]) + sources = [NSMutableArray array]; + o = [ud arrayForKey: @"SOGoLDAPSources"]; + + if (o) { - max = [udSources count]; + [self errorWithFormat: @"Using depecrated SOGoLDAPSources default. You should now use SOGoUserSources."]; + + if ([o isKindOfClass: [NSArray class]]) + [sources addObjectsFromArray: o]; + else + [self errorWithFormat: @"SOGoLDAPSources is NOT an array. Check your defaults. You should now use SOGoUserSources nonetheless."]; + } + + o = [ud arrayForKey: @"SOGoUserSources"]; + + if (o) + { + if ([o isKindOfClass: [NSArray class]]) + [sources addObjectsFromArray: o]; + else + [self errorWithFormat: @"SOGoUserSources is NOT an array. Check your defaults."]; + } + + if ([sources count]) + { + max = [sources count]; for (count = 0; count < max; count++) - [self _registerSource: [udSources objectAtIndex: count]]; - } - else - [self errorWithFormat: @"SOGoLDAPSources is not defined or it is not an array. Check your defaults."]; + [self _registerSource: [sources objectAtIndex: count]]; + } } - (id) init @@ -152,9 +183,9 @@ static NSLock *lock = nil; { ud = [NSUserDefaults standardUserDefaults]; - sources = nil; - sourcesMetadata = nil; - [self _prepareLDAPSourcesWithDefaults: ud]; + _sources = nil; + _sourcesMetadata = nil; + [self _prepareSourcesWithDefaults: ud]; } return self; @@ -162,14 +193,14 @@ static NSLock *lock = nil; - (void) dealloc { - [sources release]; - [sourcesMetadata release]; + [_sources release]; + [_sourcesMetadata release]; [super dealloc]; } - (NSArray *) sourceIDs { - return [sources allKeys]; + return [_sources allKeys]; } - (NSArray *) _sourcesOfType: (NSString *) sourceType @@ -180,10 +211,10 @@ static NSLock *lock = nil; NSNumber *canAuthenticate; sourceIDs = [NSMutableArray array]; - allIDs = [[sources allKeys] objectEnumerator]; + allIDs = [[_sources allKeys] objectEnumerator]; while ((currentID = [allIDs nextObject])) { - canAuthenticate = [[sourcesMetadata objectForKey: currentID] + canAuthenticate = [[_sourcesMetadata objectForKey: currentID] objectForKey: sourceType]; if ([canAuthenticate boolValue]) [sourceIDs addObject: currentID]; @@ -194,7 +225,7 @@ static NSLock *lock = nil; - (NSDictionary *) metadataForSourceID: (NSString *) sourceID { - return [sourcesMetadata objectForKey: sourceID]; + return [_sourcesMetadata objectForKey: sourceID]; } - (NSArray *) authenticationSourceIDs @@ -209,14 +240,14 @@ static NSLock *lock = nil; - (LDAPSource *) sourceWithID: (NSString *) sourceID { - return [sources objectForKey: sourceID]; + return [_sources objectForKey: sourceID]; } - (NSString *) displayNameForSourceWithID: (NSString *) sourceID { NSDictionary *metadata; - metadata = [sourcesMetadata objectForKey: sourceID]; + metadata = [_sourcesMetadata objectForKey: sourceID]; return [metadata objectForKey: @"displayName"]; } @@ -267,20 +298,20 @@ static NSLock *lock = nil; return [contactInfos objectForKey: @"c_uid"]; } -- (BOOL) _ldapCheckLogin: (NSString *) login - andPassword: (NSString *) password +- (BOOL) _sourceCheckLogin: (NSString *) login + andPassword: (NSString *) password { - BOOL checkOK; - LDAPSource *ldapSource; + id ldapSource; NSEnumerator *authIDs; NSString *currentID; - + BOOL checkOK; + checkOK = NO; authIDs = [[self authenticationSourceIDs] objectEnumerator]; while (!checkOK && (currentID = [authIDs nextObject])) { - ldapSource = [sources objectForKey: currentID]; + ldapSource = [_sources objectForKey: currentID]; checkOK = [ldapSource checkLogin: login andPassword: password]; } @@ -302,7 +333,7 @@ static NSLock *lock = nil; dictPassword = [currentUser objectForKey: @"password"]; if (currentUser && dictPassword) checkOK = ([dictPassword isEqualToString: password]); - else if ([self _ldapCheckLogin: login andPassword: password]) + else if ([self _sourceCheckLogin: login andPassword: password]) { checkOK = YES; if (!currentUser) @@ -329,8 +360,8 @@ static NSLock *lock = nil; - (void) _fillContactMailRecords: (NSMutableDictionary *) contact { - NSMutableArray *emails; NSString *uid, *systemEmail; + NSMutableArray *emails; emails = [contact objectForKey: @"emails"]; uid = [contact objectForKey: @"c_uid"]; @@ -367,7 +398,7 @@ static NSLock *lock = nil; ldapSources = [[self authenticationSourceIDs] objectEnumerator]; while ((sourceID = [ldapSources nextObject])) { - currentSource = [sources objectForKey: sourceID]; + currentSource = [_sources objectForKey: sourceID]; userEntry = [currentSource lookupContactEntryWithUIDorEmail: uid]; if (userEntry) { @@ -522,7 +553,7 @@ static NSLock *lock = nil; email = [userEntry objectForKey: @"mail"]; if (email && ![emails containsObject: email]) [emails addObject: email]; - email = [userEntry objectForKey: @"mozillaSecondEmail"]; + email = [userEntry objectForKey: @"mozillasecondemail"]; if (email && ![emails containsObject: email]) [emails addObject: email]; email = [userEntry objectForKey: @"xmozillasecondemail"]; @@ -551,15 +582,15 @@ static NSLock *lock = nil; matching: (NSString *) filter { NSMutableArray *contacts; - NSEnumerator *ldapSources; + NSEnumerator *sources; NSString *sourceID; - LDAPSource *currentSource; + id currentSource; contacts = [NSMutableArray array]; - ldapSources = [sourcesList objectEnumerator]; - while ((sourceID = [ldapSources nextObject])) + sources = [sourcesList objectEnumerator]; + while ((sourceID = [sources nextObject])) { - currentSource = [sources objectForKey: sourceID]; + currentSource = [_sources objectForKey: sourceID]; [contacts addObjectsFromArray: [currentSource fetchContactsMatching: filter]]; } @@ -586,7 +617,7 @@ static NSLock *lock = nil; LDAPSource *currentSource; login = nil; - ldapSources = [[sources allValues] objectEnumerator]; + ldapSources = [[_sources allValues] objectEnumerator]; while ((currentSource = [ldapSources nextObject])) { if ([theDN hasSuffix: [currentSource baseDN]]) diff --git a/SoObjects/SOGo/SOGoWebAuthenticator.m b/SoObjects/SOGo/SOGoWebAuthenticator.m index 42699608f..bda7bdc4c 100644 --- a/SoObjects/SOGo/SOGoWebAuthenticator.m +++ b/SoObjects/SOGo/SOGoWebAuthenticator.m @@ -1,6 +1,6 @@ /* SOGoWebAuthenticator.m - this file is part of SOGo * - * Copyright (C) 2007 Inverse inc. + * Copyright (C) 2007-2009 Inverse inc. * * Author: Wolfgang Sourdeau * @@ -37,7 +37,7 @@ #import -#import "LDAPUserManager.h" +#import "SOGoUserManager.h" #import "SOGoPermissions.h" #import "SOGoUser.h" @@ -88,11 +88,11 @@ password: (NSString *) _pwd { BOOL accept; - LDAPUserManager *um; + SOGoUserManager *um; if ([authMethod isEqualToString: @"LDAP"]) { - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; accept = [um checkLogin: _login andPassword: _pwd]; } else diff --git a/SoObjects/SOGo/SQLSource.h b/SoObjects/SOGo/SQLSource.h new file mode 100644 index 000000000..625ababcc --- /dev/null +++ b/SoObjects/SOGo/SQLSource.h @@ -0,0 +1,45 @@ +/* SQLSource.h - this file is part of SOGo + * + * Copyright (C) 2009 Inverse inc. + * + * Author: Ludovic Marcotte + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef SQLSOURCE_H +#define SQLSOURCE_H + +#import + +#include "SOGoSource.h" + +@class NSArray; +@class NSDictionary; +@class NSString; +@class NSURL; + +@interface SQLSource : NSObject +{ + NSString *_sourceID; + NSArray *_mailFields; + NSString *_userPasswordAlgorithm; + NSURL *_viewURL; +} + +@end + +#endif /* SQLSOURCE_H */ diff --git a/SoObjects/SOGo/SQLSource.m b/SoObjects/SOGo/SQLSource.m new file mode 100644 index 000000000..07194b5dc --- /dev/null +++ b/SoObjects/SOGo/SQLSource.m @@ -0,0 +1,329 @@ +/* SQLSource.h - this file is part of SOGo + * + * Copyright (C) 2009 Inverse inc. + * + * Author: Ludovic Marcotte + * + * This file is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This file is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; see the file COPYING. If not, write to + * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#import +#import +#import +#import +#import +#import + +#import + +#import +#import +#import +#import +#import + +#include +#include + +#include "SQLSource.h" + +/** + * The view MUST contain the following columns: + * + * c_uid - will be used for authentication - it's a username or username@domain.tld) + * c_name - which can be identical to c_uid - will be used to uniquely identify entries) + * c_password - password of the user, plain-text or md5 encoded for now + * c_cn - the user's common name + * mail - hte user's mail address + * + * Other columns can be defined - see LDAPSource.m for the complete list. + * + * + * A SQL source can be defined like this: + * + * { + * id = zot; + * type = sql; + * viewURL = "http://sogo:sogo@127.0.0.1:5432/sogo/sogo_view"; + * canAuthenticate = YES; + * isAddressBook = YES; + * userPasswordAlgorithm = md5; + * } + * + */ + +@implementation SQLSource + ++ (id) sourceFromUDSource: (NSDictionary *) udSource +{ + return [[[self alloc] initFromUDSource: udSource] autorelease]; +} + +- (id) init +{ + if ((self = [super init])) + { + _sourceID = nil; + _mailFields = nil; + _userPasswordAlgorithm = nil; + _viewURL = nil; + } + + return self; +} + +- (void) dealloc +{ + [_sourceID release]; + [_mailFields release]; + [_userPasswordAlgorithm release]; + [_viewURL release]; + + [super dealloc]; +} + +- (id) initFromUDSource: (NSDictionary *) udSource +{ + self = [self init]; + + ASSIGN(_sourceID, [udSource objectForKey: @"id"]); + ASSIGN(_mailFields, [udSource objectForKey: @"MailFieldNames"]); + ASSIGN(_userPasswordAlgorithm, [udSource objectForKey: @"userPasswordAlgorithm"]); + + if (!_userPasswordAlgorithm) + _userPasswordAlgorithm = @"none"; + + if ([udSource objectForKey: @"viewURL"]) + _viewURL = [[NSURL alloc] initWithString: [udSource objectForKey: @"viewURL"]]; + + if (!_viewURL) + { + [self autorelease]; + return nil; + } + + return self; +} + +- (BOOL) _isPassword: (NSString *) plainPassword + equalTo: (NSString *) encryptedPassword +{ + if ([_userPasswordAlgorithm caseInsensitiveCompare: @"none"] == NSOrderedSame) + { + return [plainPassword isEqualToString: encryptedPassword]; + } + else if ([_userPasswordAlgorithm caseInsensitiveCompare: @"md5"] == NSOrderedSame) + { + NSString *s; + + unsigned char md[MD5_DIGEST_LENGTH]; + char buf[80]; + int i; + + memset(md, 0, MD5_DIGEST_LENGTH); + memset(buf, 0, 80); + + EVP_Digest([plainPassword UTF8String], strlen([plainPassword UTF8String]), md, NULL, EVP_md5(), NULL); + for (i = 0; i < MD5_DIGEST_LENGTH; i++) + sprintf(&(buf[i*2]), "%02x", md[i]); + + s = [NSString stringWithUTF8String: buf]; + return [s isEqualToString: encryptedPassword]; + } + + + [self errorWithFormat: @"Unsupported user-password algorithm: %@", _userPasswordAlgorithm]; + + return NO; +} + +- (BOOL) checkLogin: (NSString *) login + andPassword: (NSString *) password +{ + EOAdaptorChannel *channel; + GCSChannelManager *cm; + NSException *ex; + NSString *sql; + + cm = [GCSChannelManager defaultChannelManager]; + channel = [cm acquireOpenChannelForURL: _viewURL]; + + sql = [NSString stringWithFormat: (@"SELECT c_password" + @" FROM %@" + @" WHERE c_uid = '%@'"), + [_viewURL gcsTableName], login]; + + ex = [channel evaluateExpressionX: sql]; + + if (!ex) + { + NSDictionary *row; + NSArray *attrs; + NSString *value; + + attrs = [channel describeResults: NO]; + row = [channel fetchAttributes: attrs withZone: NULL]; + value = [row objectForKey: @"c_password"]; + + return [self _isPassword: password equalTo: value]; + } + else + [self errorWithFormat: @"could not run SQL '%@': %@", sql, ex]; + + return NO; +} + +- (NSDictionary *) _lookupContactEntry: (NSString *) theID + considerEmail: (BOOL) b +{ + EOAdaptorChannel *channel; + GCSChannelManager *cm; + NSException *ex; + NSString *sql; + + cm = [GCSChannelManager defaultChannelManager]; + channel = [cm acquireOpenChannelForURL: _viewURL]; + + if (!b) + sql = [NSString stringWithFormat: (@"SELECT *" + @" FROM %@" + @" WHERE c_uid = '%@'"), + [_viewURL gcsTableName], theID]; + else + sql = [NSString stringWithFormat: (@"SELECT *" + @" FROM %@" + @" WHERE c_uid = '%@' OR" + @" LOWER(mail) = '%@'"), + [_viewURL gcsTableName], theID, [theID lowercaseString]]; + + ex = [channel evaluateExpressionX: sql]; + + if (!ex) + { + NSMutableDictionary *d; + + d = [NSMutableDictionary dictionaryWithDictionary: [channel fetchAttributes: + [channel describeResults: NO] + withZone: NULL]]; + + // We have to do this here since we do not manage modules constraints right + // now over a SQL backend. + [d setObject: [NSNumber numberWithBool: YES] forKey: @"CalendarAccess"]; + [d setObject: [NSNumber numberWithBool: YES] forKey: @"MailAccess"]; + + return d; + } + else + [self errorWithFormat: @"could not run SQL '%@': %@", sql, ex]; + + return nil; +} + + +- (NSDictionary *) lookupContactEntry: (NSString *) theID +{ + return [self _lookupContactEntry: theID considerEmail: NO]; +} + +- (NSDictionary *) lookupContactEntryWithUIDorEmail: (NSString *) entryID +{ + return [self _lookupContactEntry: entryID considerEmail: YES]; +} + +- (NSArray *) allEntryIDs +{ + EOAdaptorChannel *channel; + NSMutableArray *results; + GCSChannelManager *cm; + NSException *ex; + NSString *sql; + + results = [NSMutableArray array]; + + cm = [GCSChannelManager defaultChannelManager]; + channel = [cm acquireOpenChannelForURL: _viewURL]; + + sql = [NSString stringWithFormat: (@"SELECT c_uid" + @" FROM %@"), + [_viewURL gcsTableName]]; + + ex = [channel evaluateExpressionX: sql]; + + if (!ex) + { + NSDictionary *row; + NSArray *attrs; + NSString *value; + + attrs = [channel describeResults: NO]; + + while ((row = [channel fetchAttributes: attrs withZone: NULL])) + { + value = [row objectForKey: @"c_uid"]; + if (value) + [results addObject: value]; + } + } + else + [self errorWithFormat: @"could not run SQL '%@': %@", sql, ex]; + + return results; +} + +- (NSArray *) fetchContactsMatching: (NSString *) filter +{ + EOAdaptorChannel *channel; + NSMutableArray *results; + GCSChannelManager *cm; + NSException *ex; + NSString *sql; + + results = [NSMutableArray array]; + + cm = [GCSChannelManager defaultChannelManager]; + channel = [cm acquireOpenChannelForURL: _viewURL]; + + sql = [NSString stringWithFormat: (@"SELECT *" + @" FROM %@" + @" WHERE LOWER(c_cn) LIKE '%%%@%%' OR LOWER(mail) LIKE '%%%@%%'"), + [_viewURL gcsTableName], [filter lowercaseString], [filter lowercaseString]]; + + ex = [channel evaluateExpressionX: sql]; + + if (!ex) + { + NSDictionary *row; + NSArray *attrs; + + attrs = [channel describeResults: NO]; + + while ((row = [channel fetchAttributes: attrs withZone: NULL])) + { + [results addObject: row]; + } + } + else + [self errorWithFormat: @"could not run SQL '%@': %@", sql, ex]; + + return results; +} + +- (NSString *) sourceID +{ + return _sourceID; +} + +@end diff --git a/Tools/SOGoToolBackup.m b/Tools/SOGoToolBackup.m index a26a06d8d..6d45a3f9c 100644 --- a/Tools/SOGoToolBackup.m +++ b/Tools/SOGoToolBackup.m @@ -32,7 +32,7 @@ #import #import -#import +#import #import #import #import @@ -118,13 +118,13 @@ - (BOOL) fetchUserIDs: (NSArray *) users { - LDAPUserManager *lm; + SOGoUserManager *lm; NSDictionary *infos; NSString *user; id allUsers; int count, max; - lm = [LDAPUserManager sharedUserManager]; + lm = [SOGoUserManager sharedUserManager]; max = [users count]; user = [users objectAtIndex: 0]; if (max == 1 && [user isEqualToString: @"ALL"]) @@ -302,11 +302,11 @@ NSEnumerator *ldapSources; NSString *sourceID; LDAPSource *currentSource; - LDAPUserManager *lm; + SOGoUserManager *lm; NSDictionary *userEntry; BOOL done; - lm = [LDAPUserManager sharedUserManager]; + lm = [SOGoUserManager sharedUserManager]; done = NO; ldapSources = [[lm authenticationSourceIDs] objectEnumerator]; diff --git a/Tools/SOGoToolRestore.m b/Tools/SOGoToolRestore.m index a3cf80ca1..ff2e26ff0 100644 --- a/Tools/SOGoToolRestore.m +++ b/Tools/SOGoToolRestore.m @@ -33,7 +33,7 @@ #import #import -#import +#import #import #import #import @@ -130,10 +130,10 @@ - (BOOL) fetchUserID: (NSString *) identifier { BOOL rc; - LDAPUserManager *lm; + SOGoUserManager *lm; NSDictionary *infos; - lm = [LDAPUserManager sharedUserManager]; + lm = [SOGoUserManager sharedUserManager]; infos = [lm contactInfosForUserWithUIDorEmail: identifier]; ASSIGN (userID, [infos objectForKey: @"c_uid"]); if (userID) diff --git a/UI/Common/UIxAclEditor.m b/UI/Common/UIxAclEditor.m index 19de2b33d..b6eba3805 100644 --- a/UI/Common/UIxAclEditor.m +++ b/UI/Common/UIxAclEditor.m @@ -1,6 +1,6 @@ /* UIxAclEditor.m - this file is part of SOGo * - * Copyright (C) 2006, 2007 Inverse inc. + * Copyright (C) 2006-2009 Inverse inc. * * Author: Wolfgang Sourdeau * @@ -29,7 +29,7 @@ #import #import #import -#import +#import #import #import #import @@ -74,10 +74,10 @@ - (NSString *) _displayNameForUID: (NSString *) uid { - LDAPUserManager *um; + SOGoUserManager *um; NSString *s; - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; s = [uid hasPrefix: @"@"] ? [uid substringFromIndex: 1] : uid; return [NSString stringWithFormat: @"%@ <%@>", diff --git a/UI/Common/UIxFolderActions.m b/UI/Common/UIxFolderActions.m index 3f5a17f5f..cffe55a32 100644 --- a/UI/Common/UIxFolderActions.m +++ b/UI/Common/UIxFolderActions.m @@ -35,7 +35,7 @@ #import #import -#import +#import #import #import #import @@ -61,7 +61,7 @@ baseFolder = [[clientObject container] nameInContainer]; - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; ud = [activeUser userSettings]; moduleSettings = [ud objectForKey: baseFolder]; if (!moduleSettings) diff --git a/UI/Common/UIxObjectActions.m b/UI/Common/UIxObjectActions.m index 2168c8dd9..f5fa5f6be 100644 --- a/UI/Common/UIxObjectActions.m +++ b/UI/Common/UIxObjectActions.m @@ -27,7 +27,6 @@ #import #import #import -#import #import #import diff --git a/UI/Common/UIxUserRightsEditor.m b/UI/Common/UIxUserRightsEditor.m index 014d5f8f9..2ce4d42d5 100644 --- a/UI/Common/UIxUserRightsEditor.m +++ b/UI/Common/UIxUserRightsEditor.m @@ -1,6 +1,6 @@ /* UIxUserRightsEditor.m - this file is part of SOGo * - * Copyright (C) 2007 Inverse inc. + * Copyright (C) 2007-2009 Inverse inc. * * Author: Wolfgang Sourdeau * @@ -24,7 +24,7 @@ #import #import #import -#import +#import #import #import #import @@ -81,9 +81,9 @@ static BOOL sendACLAdvisories = NO; - (NSString *) userDisplayName { - LDAPUserManager *um; + SOGoUserManager *um; - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; return [NSString stringWithFormat: @"%@ <%@>", [um getCNForUID: uid], @@ -94,7 +94,7 @@ static BOOL sendACLAdvisories = NO; { BOOL response; NSString *newUID; - LDAPUserManager *um; + SOGoUserManager *um; SOGoObject *clientObject; SOGoGroup *group; @@ -106,7 +106,7 @@ static BOOL sendACLAdvisories = NO; if (!defaultUserID) ASSIGN (defaultUserID, [[self clientObject] defaultUserID]); - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; if ([newUID isEqualToString: defaultUserID] || [[um getEmailForUID: newUID] length] > 0) { diff --git a/UI/Contacts/UIxContactFoldersView.m b/UI/Contacts/UIxContactFoldersView.m index 2b46e3a19..4f43536db 100644 --- a/UI/Contacts/UIxContactFoldersView.m +++ b/UI/Contacts/UIxContactFoldersView.m @@ -1,6 +1,6 @@ /* UIxContactFoldersView.m - this file is part of SOGo * - * Copyright (C) 2006-2008 Inverse inc. + * Copyright (C) 2006-2009 Inverse inc. * * Author: Wolfgang Sourdeau * @@ -38,7 +38,7 @@ #import #import -#import +#import #import #import #import @@ -47,7 +47,7 @@ #import #import #import -#import +#import #import "UIxContactFoldersView.h" @@ -220,7 +220,7 @@ for (i = 0; i < [folders count]; i++) { folder = [folders objectAtIndex: i]; - if ([folder isKindOfClass: [SOGoContactLDAPFolder class]]) + if ([folder isKindOfClass: [SOGoContactSourceFolder class]]) [sortedFolders insertObject: folder atIndex: 0]; else [sortedFolders addObject: folder]; @@ -281,12 +281,12 @@ NSArray *contacts; NSString *searchText; id result; - LDAPUserManager *um; + SOGoUserManager *um; searchText = [self queryParameterForKey: @"search"]; if ([searchText length] > 0) { - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; contacts = [self _responseForResults: [um fetchContactsMatching: searchText]]; data = [NSDictionary dictionaryWithObjectsAndKeys: searchText, @"searchText", @@ -420,7 +420,7 @@ - (NSString *) currentContactFolderClass { - return ([currentFolder isKindOfClass: [SOGoContactLDAPFolder class]]? @"remote" : @"local"); + return ([currentFolder isKindOfClass: [SOGoContactSourceFolder class]]? @"remote" : @"local"); } - (WOResponse *) saveDragHandleStateAction diff --git a/UI/Contacts/product.plist b/UI/Contacts/product.plist index b04a6ef81..5532a8b00 100644 --- a/UI/Contacts/product.plist +++ b/UI/Contacts/product.plist @@ -120,7 +120,7 @@ }; }; - SOGoContactLDAPFolder = { + SOGoContactSourceFolder = { slots = { toolbar = { protectedBy = "View"; diff --git a/UI/MainUI/SOGoUserHomePage.m b/UI/MainUI/SOGoUserHomePage.m index 7d895f461..02de6ad66 100644 --- a/UI/MainUI/SOGoUserHomePage.m +++ b/UI/MainUI/SOGoUserHomePage.m @@ -36,7 +36,7 @@ #import #import -#import +#import #import #import #import @@ -334,6 +334,8 @@ static NSString *LDAPContactInfoAttribute = nil; { contact = [allUsers objectAtIndex: i]; uid = [contact objectForKey: @"c_uid"]; + + // We do NOT return the current authenticated user. if (![uid isEqualToString: login]) { if ([LDAPContactInfoAttribute length]) @@ -360,9 +362,9 @@ static NSString *LDAPContactInfoAttribute = nil; { NSString *contact; id result; - LDAPUserManager *um; + SOGoUserManager *um; - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; contact = [self queryParameterForKey: @"search"]; if ([contact length]) { diff --git a/UI/SOGoUI/SOGoACLAdvisory.m b/UI/SOGoUI/SOGoACLAdvisory.m index 5cd1dd2fe..722fd003a 100644 --- a/UI/SOGoUI/SOGoACLAdvisory.m +++ b/UI/SOGoUI/SOGoACLAdvisory.m @@ -31,7 +31,7 @@ #import #import #import -#import +#import #import #import @@ -203,7 +203,7 @@ fullMail = [NSString stringWithFormat: @"%@ <%@>", [identity objectForKey: @"fullName"], from]; - recipient = [[LDAPUserManager sharedUserManager] + recipient = [[SOGoUserManager sharedUserManager] getFullEmailForUID: recipientUID]; headerMap = [NGMutableHashMap hashMapWithCapacity: 5]; diff --git a/UI/SOGoUI/SOGoFolderAdvisory.m b/UI/SOGoUI/SOGoFolderAdvisory.m index be945630c..7e84f51fd 100644 --- a/UI/SOGoUI/SOGoFolderAdvisory.m +++ b/UI/SOGoUI/SOGoFolderAdvisory.m @@ -31,7 +31,7 @@ #import #import #import -#import +#import #import #import @@ -182,7 +182,7 @@ fullMail = [NSString stringWithFormat: @"%@ <%@>", [identity objectForKey: @"fullName"], from]; - recipient = [[LDAPUserManager sharedUserManager] + recipient = [[SOGoUserManager sharedUserManager] getFullEmailForUID: recipientUID]; headerMap = [NGMutableHashMap hashMapWithCapacity: 5]; diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index 21afa9a1f..abeeec8eb 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -55,7 +55,7 @@ #import #import #import -#import +#import #import #import #import @@ -243,10 +243,10 @@ iRANGE(2); NSMutableDictionary *currentAttendeeData; iCalPerson *currentAttendee; NSString *uid; - LDAPUserManager *um; + SOGoUserManager *um; jsonAttendees = [NSMutableDictionary new]; - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; attendees = [[component attendees] objectEnumerator]; while ((currentAttendee = [attendees nextObject])) @@ -527,7 +527,7 @@ iRANGE(2); { // iCalRecurrenceRule *rrule; SOGoObject *co; - LDAPUserManager *um; + SOGoUserManager *um; NSString *owner, *ownerEmail; if (!component) @@ -560,7 +560,7 @@ iRANGE(2); componentCalendar = [componentCalendar container]; [componentCalendar retain]; - um = [LDAPUserManager sharedUserManager]; + um = [SOGoUserManager sharedUserManager]; owner = [componentCalendar ownerInContext: context]; ownerEmail = [um getEmailForUID: owner]; ASSIGN (ownerAsAttendee, [component findParticipantWithEmail: (id)ownerEmail]);