diff --git a/ChangeLog b/ChangeLog index 10141b9bf..7457383f6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2011-07-19 Francis Lachapelle + + * SoObjects/SOGo/SOGoUserFolder.m (-_davFetchUsersMatching:): + append the domain to the username when SOGoEnableDomainWithUID is + set to YES. When using domains, fetch matching users from visible + domains. + 2011-07-18 Wolfgang Sourdeau * OpenChange/NSString+MAPIStore.m (-asUnicodeInMemCtx:): use an @@ -6,16 +13,20 @@ 2011-07-18 Francis Lachapelle - * SoObjects/SOGo/SOGoSystemDefaults.m (-addDomainToUID): new + * SoObjects/SOGo/SOGoSystemDefaults.m (-enableDomainWithUID): new method that returns the boolean value of the new system defaults - SOGoAddDomainToUID if at least one domain is defined. + SOGoEnableDomainWithUID if at least one domain is defined. - * SoObjects/SOGo/SOGoUser.m (-initWithLogin:roles:trust:): we now - try to extract the domain part of the login name only if the new - system defaults SOGoAddDomainToUID is set to YES. + * SoObjects/SOGo/SOGoUser.m (-initWithLogin:roles:trust:): try to + extract the domain part of the login name only if the new system + defaults SOGoEnableDomainWithUID is set to YES. If the domain is not + specified but SOGoEnableDomainWithUID is enabled, add the domain to the + login name. * SoObjects/SOGo/SOGoUserManager.m - (-contactInfosForUserWithUIDorEmail): idem. + (-contactInfosForUserWithUIDorEmail): try to extract the domain + part of the login name only if the new system defaults + SOGoEnableDomainWithUID is set to YES.. * SoObjects/SOGo/SOGoSession.m (+decodeValue:usingKey:login:domain:password:): idem. @@ -27,7 +38,7 @@ * UI/MainUI/SOGoUserHomePage.m (-usersSearchAction): only append the domain to the user's login if the new system defaults - SOGoAddToDomainToUID is set to YES. + SOGoEnableDomainWithUID is set to YES. 2011-07-15 Wolfgang Sourdeau diff --git a/Documentation/SOGo Installation Guide.odt b/Documentation/SOGo Installation Guide.odt index 93bd0d89c..e7d97b6bf 100644 Binary files a/Documentation/SOGo Installation Guide.odt and b/Documentation/SOGo Installation Guide.odt differ diff --git a/SoObjects/SOGo/SOGoDefaults.plist b/SoObjects/SOGo/SOGoDefaults.plist index 7b3e4cc9f..03349808e 100644 --- a/SoObjects/SOGo/SOGoDefaults.plist +++ b/SoObjects/SOGo/SOGoDefaults.plist @@ -29,7 +29,7 @@ SOGoWebAccessEnabled = YES; SOGoCalendarDAVAccessEnabled = YES; SOGoAddressBookDAVAccessEnabled = YES; - SOGoAddDomainToUID = NO; + SOGoEnableDomainWithUID = NO; SOGoLoginModule = "Mail"; SOGoLanguage = "English"; diff --git a/SoObjects/SOGo/SOGoSession.m b/SoObjects/SOGo/SOGoSession.m index d795e6e1c..aa90da221 100644 --- a/SoObjects/SOGo/SOGoSession.m +++ b/SoObjects/SOGo/SOGoSession.m @@ -254,7 +254,7 @@ *theDomain = nil; sd = [SOGoSystemDefaults sharedSystemDefaults]; - if ([sd addDomainToUID]) + if ([sd enableDomainWithUID]) { r = [*theLogin rangeOfString: @"@" options: NSBackwardsSearch]; if (r.location != NSNotFound) diff --git a/SoObjects/SOGo/SOGoSystemDefaults.h b/SoObjects/SOGo/SOGoSystemDefaults.h index ae241774e..af959bbed 100644 --- a/SoObjects/SOGo/SOGoSystemDefaults.h +++ b/SoObjects/SOGo/SOGoSystemDefaults.h @@ -34,7 +34,7 @@ + (SOGoSystemDefaults *) sharedSystemDefaults; - (NSArray *) domainIds; -- (BOOL) addDomainToUID; +- (BOOL) enableDomainWithUID; - (NSArray *) loginDomains; - (NSArray *) visibleDomainsForDomain: (NSString *) domain; diff --git a/SoObjects/SOGo/SOGoSystemDefaults.m b/SoObjects/SOGo/SOGoSystemDefaults.m index f67fb3a19..44112bf7c 100644 --- a/SoObjects/SOGo/SOGoSystemDefaults.m +++ b/SoObjects/SOGo/SOGoSystemDefaults.m @@ -193,9 +193,9 @@ BootstrapNSUserDefaults () return [[self dictionaryForKey: @"domains"] allKeys]; } -- (BOOL) addDomainToUID +- (BOOL) enableDomainWithUID { - return ([[self domainIds] count] > 0 && [self boolForKey: @"SOGoAddDomainToUID"]); + return ([[self domainIds] count] > 0 && [self boolForKey: @"SOGoEnableDomainWithUID"]); } - (NSArray *) loginDomains diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index e68089bd1..dd0358cab 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -125,7 +125,7 @@ /** * Return a new instance for the login name, which can be appended by a * domain name. The domain is extracted only if the system defaults - * SOGoAddDomainToUID is enabled. + * SOGoEnableDomainWithUID is enabled. * * @param newLogin a login name optionally follow by @domain * @param newRoles @@ -139,6 +139,7 @@ { SOGoUserManager *um; SOGoSystemDefaults *sd; + NSDictionary *contactInfos; NSString *realUID, *uid, *domain; NSRange r; @@ -154,7 +155,7 @@ else { sd = [SOGoSystemDefaults sharedSystemDefaults]; - if ([sd addDomainToUID]) + if ([sd enableDomainWithUID]) { r = [newLogin rangeOfString: @"@" options: NSBackwardsSearch]; if (r.location != NSNotFound) @@ -176,9 +177,11 @@ else { um = [SOGoUserManager sharedUserManager]; - realUID = [[um contactInfosForUserWithUIDorEmail: newLogin - inDomain: domain] - objectForKey: @"c_uid"]; + contactInfos = [um contactInfosForUserWithUIDorEmail: newLogin + inDomain: domain]; + realUID = [contactInfos objectForKey: @"c_uid"]; + if (domain == nil && [sd enableDomainWithUID]) + domain = [contactInfos objectForKey: @"c_domain"]; } if (domain) diff --git a/SoObjects/SOGo/SOGoUserFolder.m b/SoObjects/SOGo/SOGoUserFolder.m index b98b2dc70..5241b30bc 100644 --- a/SoObjects/SOGo/SOGoUserFolder.m +++ b/SoObjects/SOGo/SOGoUserFolder.m @@ -1,6 +1,6 @@ /* Copyright (C) 2004-2005 SKYRIX Software AG - Copyright (C) 2007-2009 Inverse inc. + Copyright (C) 2007-2011 Inverse inc. This file is part of OpenGroupware.org. @@ -390,45 +390,56 @@ - (NSString *) _davFetchUsersMatching: (NSString *) user { SOGoUserManager *um; + SOGoSystemDefaults *sd; NSMutableString *fetch; + NSEnumerator *domains; NSDictionary *currentUser; NSString *field, *login, *domain; NSArray *users; int i; + BOOL enableDomainWithUID; #warning the attributes returned here should match the one requested in the query fetch = [NSMutableString string]; login = [[context activeUser] login]; um = [SOGoUserManager sharedUserManager]; - + sd = [SOGoSystemDefaults sharedSystemDefaults]; + enableDomainWithUID = [sd enableDomainWithUID]; domain = [[context activeUser] domain]; - // We sort our array - this is pretty useful for the - // SOGo Integrator extension, among other things. - users = [[um fetchUsersMatching: user inDomain: domain] - sortedArrayUsingSelector: @selector (caseInsensitiveDisplayNameCompare:)]; - for (i = 0; i < [users count]; i++) + domains = [[sd visibleDomainsForDomain: domain] objectEnumerator]; + while (domain) { - currentUser = [users objectAtIndex: i]; - field = [currentUser objectForKey: @"c_uid"]; - if (![field isEqualToString: login]) + // We sort our array - this is pretty useful for the + // SOGo Integrator extension, among other things. + users = [[um fetchUsersMatching: user inDomain: domain] + sortedArrayUsingSelector: @selector (caseInsensitiveDisplayNameCompare:)]; + for (i = 0; i < [users count]; i++) { - [fetch appendFormat: @"%@", - [field stringByEscapingXMLString]]; - field = [currentUser objectForKey: @"cn"]; - [fetch appendFormat: @"%@", - [field stringByEscapingXMLString]]; - field = [currentUser objectForKey: @"c_email"]; - [fetch appendFormat: @"%@", - [field stringByEscapingXMLString]]; - field = [currentUser objectForKey: @"c_info"]; - if ([field length]) - [fetch appendFormat: @"%@", - [field stringByEscapingXMLString]]; - [fetch appendString: @""]; + currentUser = [users objectAtIndex: i]; + field = [currentUser objectForKey: @"c_uid"]; + if (enableDomainWithUID) + field = [NSString stringWithFormat: @"%@@%@", field, domain]; + if (![field isEqualToString: login]) + { + [fetch appendFormat: @"%@", + [field stringByEscapingXMLString]]; + field = [currentUser objectForKey: @"cn"]; + [fetch appendFormat: @"%@", + [field stringByEscapingXMLString]]; + field = [currentUser objectForKey: @"c_email"]; + [fetch appendFormat: @"%@", + [field stringByEscapingXMLString]]; + field = [currentUser objectForKey: @"c_info"]; + if ([field length]) + [fetch appendFormat: @"%@", + [field stringByEscapingXMLString]]; + [fetch appendString: @""]; + } } + domain = [domains nextObject]; } - + return fetch; } diff --git a/SoObjects/SOGo/SOGoUserManager.m b/SoObjects/SOGo/SOGoUserManager.m index e67389444..7ae65a416 100644 --- a/SoObjects/SOGo/SOGoUserManager.m +++ b/SoObjects/SOGo/SOGoUserManager.m @@ -716,7 +716,7 @@ infos = nil; sd = [SOGoSystemDefaults sharedSystemDefaults]; - if ([sd addDomainToUID]) + if ([sd enableDomainWithUID]) { r = [uid rangeOfString: @"@" options: NSBackwardsSearch]; if (r.location != NSNotFound) diff --git a/UI/MainUI/SOGoUserHomePage.m b/UI/MainUI/SOGoUserHomePage.m index c7cc41906..513792ec0 100644 --- a/UI/MainUI/SOGoUserHomePage.m +++ b/UI/MainUI/SOGoUserHomePage.m @@ -378,7 +378,7 @@ um = [SOGoUserManager sharedUserManager]; sd = [SOGoSystemDefaults sharedSystemDefaults]; domain = [[context activeUser] domain]; - uidDomain = [sd addDomainToUID]? domain : nil; + uidDomain = [sd enableDomainWithUID]? domain : nil; users = [self _usersForResults: [um fetchUsersMatching: contact inDomain: domain] inDomain: uidDomain];