From 53feece8924851dc38004f9dbc4563631c610bef Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 3 Jan 2012 22:52:27 +0000 Subject: [PATCH] Monotone-Parent: f2f2f66b3df579ca384e578aded6976b6634ffcb Monotone-Revision: c7009a2d8a1dce845aa1a365123f4b438e3168fe Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2012-01-03T22:52:27 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 11 +++++++++++ SoObjects/SOGo/SOGoUser.h | 3 +++ SoObjects/SOGo/SOGoUser.m | 11 +++++++++++ SoObjects/SOGo/SOGoUserManager.m | 6 ++++-- 4 files changed, 29 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3855edc51..96dc5e476 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2012-01-03 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoUser.m (-authenticationSource): new method + that returned the SOGoSource instance that successfully recognized + the user represented by the current instance. + + * SoObjects/SOGo/SOGoUserManager.m + (_fillContactInfosForUser:withUIDorEmail:inDomain:): we now set + the identifier of the source that authenticated the specified user + as the "SOGoSource" entry of the returned dictionary. + 2011-12-30 Wolfgang Sourdeau * SoObjects/SOGo/LDAPSourceSchema.[hm]: new class module enabling diff --git a/SoObjects/SOGo/SOGoUser.h b/SoObjects/SOGo/SOGoUser.h index 7400021a9..7e7f0982e 100644 --- a/SoObjects/SOGo/SOGoUser.h +++ b/SoObjects/SOGo/SOGoUser.h @@ -52,6 +52,8 @@ @class SOGoUserProfile; @class SOGoUserSettings; +@protocol SOGoSource; + @interface SOGoUser : SoUser { SOGoUserDefaults *_defaults; @@ -88,6 +90,7 @@ /* properties */ - (NSString *) domain; +- (id ) authenticationSource; - (NSArray *) allEmails; - (BOOL) hasEmail: (NSString *) email; diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index 4d7aa6c67..ba4c0e471 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -287,6 +287,17 @@ return [self _fetchFieldForUser: @"c_domain"]; } +- (id ) authenticationSource +{ + NSString *sourceID; + SOGoUserManager *um; + + sourceID = [self _fetchFieldForUser: @"SOGoSource"]; + um = [SOGoUserManager sharedUserManager]; + + return [um sourceWithID: sourceID]; +} + - (NSArray *) allEmails { if (!allEmails) diff --git a/SoObjects/SOGo/SOGoUserManager.m b/SoObjects/SOGo/SOGoUserManager.m index 6d5e1415e..336585ba6 100644 --- a/SoObjects/SOGo/SOGoUserManager.m +++ b/SoObjects/SOGo/SOGoUserManager.m @@ -573,7 +573,7 @@ NSMutableArray *emails; NSDictionary *userEntry; NSEnumerator *sogoSources; - NSObject *currentSource; + NSObject *currentSource; NSString *sourceID, *cn, *c_domain, *c_uid, *c_imaphostname, *c_imaplogin; NSArray *c_emails; BOOL access; @@ -592,12 +592,14 @@ sogoSources = [[self authenticationSourceIDsInDomain: domain] objectEnumerator]; - while ((sourceID = [sogoSources nextObject])) + userEntry = nil; + while (!userEntry && (sourceID = [sogoSources nextObject])) { currentSource = [_sources objectForKey: sourceID]; userEntry = [currentSource lookupContactEntryWithUIDorEmail: uid]; if (userEntry) { + [currentUser setObject: sourceID forKey: @"SOGoSource"]; if (!cn) cn = [userEntry objectForKey: @"c_cn"]; if (!c_uid)