diff --git a/ChangeLog b/ChangeLog index 8904490af..98ee8c52d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2007-03-27 Wolfgang Sourdeau + * SoObjects/SOGo/AgenorUserManager.m ([AgenorUserManager + -getUserDefaultsForUID:uid]): rewrote method to use the "defaults" + field of the sogo_user_profile table, where the user-customizable + changes will be saved. + ([AgenorUserManager -getUserSettingsForUID:uid]): new method + similar to the one above, using the "settings" field where the + automatic settings will be saved. + * SoObjects/SOGo/AgenorUserDefaults.m: rewrote a big part of the module to bind the userdefaults to a property list contained in a specified field of the sogo_user_profile table. diff --git a/SoObjects/SOGo/AgenorUserManager.h b/SoObjects/SOGo/AgenorUserManager.h index c23fd460a..2ad609093 100644 --- a/SoObjects/SOGo/AgenorUserManager.h +++ b/SoObjects/SOGo/AgenorUserManager.h @@ -75,7 +75,8 @@ - (NSURL *)getFreeBusyURLForUID:(NSString *)_uid; -- (NSUserDefaults *)getUserDefaultsForUID:(NSString *)_uid; +- (NSUserDefaults *) getUserDefaultsForUID: (NSString *) uid; +- (NSUserDefaults *) getUserSettingsForUID: (NSString *) uid; - (BOOL)isUserAllowedToChangeSOGoInternetAccess:(NSString *)_uid; diff --git a/SoObjects/SOGo/AgenorUserManager.m b/SoObjects/SOGo/AgenorUserManager.m index b316a11a4..619e66623 100644 --- a/SoObjects/SOGo/AgenorUserManager.m +++ b/SoObjects/SOGo/AgenorUserManager.m @@ -1012,22 +1012,39 @@ static unsigned PoolScanInterval = 5 * 60 /* every five minutes */; /* defaults */ -- (NSUserDefaults *)getUserDefaultsForUID:(NSString *)_uid { +- (NSUserDefaults *) _getUserDefaultsForUID: (NSString *) uid + fieldName: (NSString *) fieldName +{ id defaults; - if (AgenorProfileURL == nil) { - [self warnWithFormat: - @"no profile configured, cannot retrieve defaults for user: '%@'", - _uid]; - return nil; - } - - /* Note: do not cache, otherwise updates can be quite tricky */ - defaults = [[[AgenorUserDefaults alloc] - initWithTableURL:AgenorProfileURL uid:_uid] autorelease]; + if (AgenorProfileURL) + { + /* Note: do not cache, otherwise updates can be quite tricky */ + defaults = [[AgenorUserDefaults alloc] initWithTableURL: AgenorProfileURL + uid: uid fieldName: fieldName]; + [defaults autorelease]; + } + else + { + [self warnWithFormat: + @"no profile configured, cannot retrieve defaults for user: '%@'", + uid]; + return defaults = nil; + } + return defaults; } +- (NSUserDefaults *) getUserDefaultsForUID: (NSString *) uid +{ + return [self _getUserDefaultsForUID: uid fieldName: @"defaults"]; +} + +- (NSUserDefaults *) getUserSettingsForUID: (NSString *) uid +{ + return [self _getUserDefaultsForUID: uid fieldName: @"settings"]; +} + /* internet access lock */ - (BOOL)isUserAllowedToChangeSOGoInternetAccess:(NSString *)_uid { @@ -1194,15 +1211,4 @@ static unsigned PoolScanInterval = 5 * 60 /* every five minutes */; return debugOn; } -/* description */ - -- (NSString *)description { - NSMutableString *ms; - - ms = [NSMutableString stringWithCapacity:16]; - [ms appendFormat:@"<0x%08X[%@]", self, NSStringFromClass([self class])]; - [ms appendString:@">"]; - return ms; -} - @end /* AgenorUserManager */