From 44c36621a88856b8263ab34c3b3cee19cc285e5c Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 27 Jul 2011 14:53:12 +0000 Subject: [PATCH] See ChangeLog. Monotone-Parent: b0613f483a296b882038d9d023bcb71c82d4916e Monotone-Revision: ed98effe549d74bf8029681e84b1654da70530c3 Monotone-Author: flachapelle@inverse.ca Monotone-Date: 2011-07-27T14:53:12 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 10 ++++++++++ SoObjects/SOGo/SOGoUser.m | 8 +++++++- SoObjects/SOGo/SOGoUserFolder.m | 10 +++++++++- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3a60e3085..dc9d54b09 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2011-07-27 Francis Lachapelle + + * SoObjects/SOGo/SOGoUserFolder.m (-ownerInContext:): in case the + user domain is specified in the URL but not in the user login + name, we remove it (user@domain => user). + + * SoObjects/SOGo/SOGoUser.m (-initWithLogin:roles:trust:): drop + the domain from the login name when loginDomains are enabled but + domain-based UID is disabled. + 2011-07-26 Francis Lachapelle * UI/MailerUI/UIxMailListActions.m diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index 6363aad2d..4d7aa6c67 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -156,7 +156,7 @@ else { sd = [SOGoSystemDefaults sharedSystemDefaults]; - if ([sd enableDomainBasedUID]) + if ([sd enableDomainBasedUID] || [[sd loginDomains] count] > 0) { r = [newLogin rangeOfString: @"@" options: NSBackwardsSearch]; if (r.location != NSNotFound) @@ -168,6 +168,12 @@ newLogin = [newLogin substringToIndex: r.location]; else domain = nil; + + if (domain != nil && ![sd enableDomainBasedUID]) + // Login domains are enabled (SOGoLoginDomains) but not + // domain-based UID (SOGoEnableDomainBasedUID). + // Drop the domain from the login name. + domain = nil; } } diff --git a/SoObjects/SOGo/SOGoUserFolder.m b/SoObjects/SOGo/SOGoUserFolder.m index 4e10614a1..1584ef8bb 100644 --- a/SoObjects/SOGo/SOGoUserFolder.m +++ b/SoObjects/SOGo/SOGoUserFolder.m @@ -103,12 +103,20 @@ - (NSString *) ownerInContext: (WOContext *) _ctx { + NSString *login; SOGoUser *ownerUser; if (!owner) { ownerUser = [SOGoUser userWithLogin: nameInContainer roles: nil]; - [self setOwner: [ownerUser login]]; + login = [ownerUser login]; + [self setOwner: login]; + if (![nameInContainer isEqualToString: login]) + // In case the user domain is specified in the URL but not in the user + // login name, we remove it (user@domain => user). + // This happens when SOGoLoginDomains is defined but + // SOGoEnableDomainBasedUID is disabled. + ASSIGN(nameInContainer, login); } return owner;