Monotone-Parent: 786210997f829cabfafa14947b9eca68c7e9a190

Monotone-Revision: f9d7e117fe9d85a0017ebef4308d4c2f72289bbe

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-11-08T17:12:30
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-11-08 17:12:30 +00:00
parent 8a67f9cf03
commit 9f99c25961
3 changed files with 65 additions and 12 deletions
+9
View File
@@ -1,5 +1,14 @@
2007-11-08 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Appointments/SOGoAppointmentFolder.m
([SOGoAppointmentFolder -create]): overriden method that invokes
its ancestor and then activate itself within the user settings.
* SoObjects/SOGo/SOGoParentFolder.m ([SOGoParentFolder
-appendPersonalSources]): when the user is the owner of the
current folder, we create the "personal" folder if it doesn't
exist by invoking "create".
* SoObjects/SOGo/AgenorUserDefaults.m ([AgenorUserDefaults
-primaryFetchProfile]): when no row is returned, we initialize
"values" to a new dictionary. This solves a bug where the defaults
@@ -48,6 +48,7 @@
#import <SOGo/SOGoCustomGroupFolder.h>
#import <SOGo/LDAPUserManager.h>
#import <SOGo/SOGoPermissions.h>
#import <SOGo/NSArray+Utilities.h>
#import <SOGo/NSString+Utilities.h>
#import <SOGo/SOGoUser.h>
@@ -962,6 +963,40 @@ static NSNumber *sharedYes = nil;
}
/* folder management */
- (BOOL) create
{
BOOL rc;
NSMutableArray *folderSubscription;
NSUserDefaults *userSettings;
NSMutableDictionary *calendarSettings;
SOGoUser *ownerUser;
rc = [super create];
if (rc)
{
ownerUser = [SOGoUser userWithLogin: [self ownerInContext: context]
roles: nil];
userSettings = [ownerUser userSettings];
calendarSettings = [userSettings objectForKey: @"Calendar"];
if (!calendarSettings)
{
calendarSettings = [NSMutableDictionary dictionary];
[userSettings setObject: calendarSettings forKey: @"Calendar"];
}
folderSubscription
= [calendarSettings objectForKey: @"ActiveFolders"];
if (!folderSubscription)
{
folderSubscription = [NSMutableArray array];
[calendarSettings setObject: folderSubscription
forKey: @"ActiveFolders"];
}
[folderSubscription addObjectUniquely: nameInContainer];
[userSettings synchronize];
}
return rc;
}
- (id) lookupHomeFolderForUID: (NSString *) _uid
inContext: (id)_ctx
+21 -12
View File
@@ -32,6 +32,7 @@
#import <GDLAccess/EOAdaptorChannel.h>
#import "SOGoGCSFolder.h"
#import "SOGoPermissions.h"
#import "SOGoUser.h"
#import "SOGoParentFolder.h"
@@ -81,13 +82,30 @@
return @"Personal";
}
- (void) _createPersonalFolder
{
NSArray *roles;
SOGoGCSFolder *folder;
roles = [[context activeUser] rolesForObject: self inContext: context];
if ([roles containsObject: SoRole_Owner])
{
folder = [subFolderClass objectWithName: @"personal" inContainer: self];
[folder setDisplayName: [self defaultFolderName]];
[folder
setOCSPath: [NSString stringWithFormat: @"%@/personal", OCSPath]];
if ([folder create])
[subFolders setObject: folder forKey: @"personal"];
}
}
- (void) _fetchPersonalFolders: (NSString *) sql
withChannel: (EOAdaptorChannel *) fc
{
NSArray *attrs;
NSDictionary *row;
SOGoGCSFolder *folder;
BOOL hasPersonal;
SOGoGCSFolder *folder;
NSString *key;
if (!subFolderClass)
@@ -111,17 +129,8 @@
row = [fc fetchAttributes: attrs withZone: NULL];
}
// if (!hasPersonal)
// {
// folder = [subFolderClass objectWithName: @"personal" inContainer: self];
// personalName = [self labelForKey: [self defaultFolderName]];
// [folder setDisplayName: personalName];
// path = [NSString stringWithFormat: @"/Users/%@/%@/personal",
// [self ownerInContext: context],
// nameInContainer];
// [folder setOCSPath: path];
// [subFolders setObject: folder forKey: @"personal"];
// }
if (!hasPersonal)
[self _createPersonalFolder];
}
- (void) appendPersonalSources