Monotone-Parent: 2092d2f6cbf44065b7b2270044f0ccf6fecd8870

Monotone-Revision: e18a1dc8a0b33293a44781d7fe494c55e2992f5f

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-09-11T20:25:57
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2007-09-11 20:25:57 +00:00
parent ac87ef0695
commit 4e2b98c36e
3 changed files with 62 additions and 3 deletions
+7
View File
@@ -1,5 +1,12 @@
2007-09-11 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/SOGo/SOGoFolder.m ([SOGoFolder
+folderWithName:aNameandDisplayName:aDisplayNameinContainer:aContainer]):
new method.
([SOGoFolder -displayName]): new method.
([SOGoFolder -delete]): accept to proceed only if nameInContainer
!= "personal".
* SoObjects/Contacts/SOGoContactLDAPFolder.m
([SOGoContactLDAPFolder
+folderWithName:aNameandDisplayName:aDisplayNameinContainer:aContainer]):
+11 -1
View File
@@ -43,7 +43,8 @@
@interface SOGoFolder : SOGoObject
{
NSString *ocsPath;
NSString *displayName;
NSString *ocsPath;
GCSFolder *ocsFolder;
NSMutableDictionary *aclCache;
}
@@ -52,6 +53,15 @@
/* accessors */
+ (id) folderWithName: (NSString *) aName
andDisplayName: (NSString *) aDisplayName
inContainer: (id) aContainer;
- (id) initWithName: (NSString *) aName
andDisplayName: (NSString *) aDisplayName
inContainer: (id) aContainer;
- (NSString *) displayName;
- (void) setOCSPath: (NSString *)_Path;
- (NSString *) ocsPath;
+44 -2
View File
@@ -29,6 +29,7 @@
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSURL.h>
#import <NGObjWeb/NSException+HTTP.h>
#import <NGObjWeb/SoObject.h>
#import <NGObjWeb/SoObject+SoDAV.h>
#import <NGObjWeb/SoSelectorInvocation.h>
@@ -85,14 +86,30 @@ static NSString *defaultUserID = @"<default>";
}
sequence++;
f = [[NSDate date] timeIntervalSince1970];
return [NSString stringWithFormat:@"%0X-%0X-%0X-%0X",
pid, *(int *)&f, sequence++, random];
pid, (int) f, sequence++, random];
}
+ (id) folderWithName: (NSString *) aName
andDisplayName: (NSString *) aDisplayName
inContainer: (id) aContainer
{
id newFolder;
newFolder = [[self alloc] initWithName: aName
andDisplayName: aDisplayName
inContainer: aContainer];
[newFolder autorelease];
return newFolder;
}
- (id) init
{
if ((self = [super init]))
{
displayName = nil;
ocsPath = nil;
ocsFolder = nil;
aclCache = [NSMutableDictionary new];
@@ -101,11 +118,23 @@ static NSString *defaultUserID = @"<default>";
return self;
}
- (id) initWithName: (NSString *) aName
andDisplayName: (NSString *) aDisplayName
inContainer: (id) aContainer
{
if ((self = [self initWithName: aName
inContainer: aContainer]))
ASSIGN (displayName, aDisplayName);
return self;
}
- (void) dealloc
{
[ocsFolder release];
[ocsPath release];
[aclCache release];
[displayName release];
[super dealloc];
}
@@ -154,6 +183,11 @@ static NSString *defaultUserID = @"<default>";
return NO;
}
- (NSString *) displayName
{
return displayName;
}
- (GCSFolder *) ocsFolder
{
GCSFolder *folder;
@@ -196,7 +230,15 @@ static NSString *defaultUserID = @"<default>";
- (NSException *) delete
{
return [[self folderManager] deleteFolderAtPath: ocsPath];
NSException *error;
if ([nameInContainer isEqualToString: @"personal"])
error = [NSException exceptionWithHTTPStatus: 403
reason: @"the 'personal' folder cannot be deleted"];
else
error = [[self folderManager] deleteFolderAtPath: ocsPath];
return error;
}
- (NSArray *) fetchContentObjectNames