From 5c27e60602cf1a0f67d4c65864c15ff99220471f Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Fri, 22 Jun 2007 19:58:31 +0000 Subject: [PATCH] Monotone-Parent: c991261163c8c9a35643794546cb61c14e85af33 Monotone-Revision: 1915e9dbb25e68de74dac3bf1f7971c87ce2bf5c Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-06-22T19:58:31 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 8 ++++++++ SoObjects/SOGo/SOGoUser.m | 18 +++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index d40f30339..b5213feb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2007-06-22 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoUser.m ([SOGoUser +initialize]): new module + bool var "acceptAnyUser" that is set when the AuthenticationMethod + user default is nil. + ([SOGoUser -initWithLogin:newLoginroles:newRoles]): + unconditionnally returns an instance whenever acceptAnyUser is set. + 2007-06-21 Wolfgang Sourdeau * Main/sogod.m (main): prevent SOGo from running as root. diff --git a/SoObjects/SOGo/SOGoUser.m b/SoObjects/SOGo/SOGoUser.m index a79694b9e..87383f4d8 100644 --- a/SoObjects/SOGo/SOGoUser.m +++ b/SoObjects/SOGo/SOGoUser.m @@ -40,6 +40,7 @@ static NSTimeZone *serverTimeZone = nil; static NSString *fallbackIMAP4Server = nil; static NSString *defaultLanguage = nil; static NSURL *AgenorProfileURL = nil; +static BOOL acceptAnyUser = NO; NSString *SOGoWeekStartHideWeekNumbers = @"HideWeekNumbers"; NSString *SOGoWeekStartJanuary1 = @"January1"; @@ -83,6 +84,8 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; if (!defaultLanguage) ASSIGN (defaultLanguage, @"English"); } + + acceptAnyUser = (![ud stringForKey: @"AuthentificationMethod"]); } + (SOGoUser *) userWithLogin: (NSString *) newLogin @@ -115,17 +118,22 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek"; roles: (NSArray *) newRoles { LDAPUserManager *um; - NSDictionary *user; + NSString *realUID; if ([newLogin isEqualToString: @"anonymous"] || [newLogin isEqualToString: @"freebusy"]) self = [super initWithLogin: newLogin roles: newRoles]; else { - um = [LDAPUserManager sharedUserManager]; - user = [um contactInfosForUserWithUIDorEmail: newLogin]; - self = [super initWithLogin: [user objectForKey: @"c_uid"] - roles: newRoles]; + if (acceptAnyUser) + realUID = newLogin; + else + { + um = [LDAPUserManager sharedUserManager]; + realUID = [[um contactInfosForUserWithUIDorEmail: newLogin] + objectForKey: @"c_uid"]; + } + self = [super initWithLogin: realUID roles: newRoles]; } return self;