mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-06-09 20:39:44 +00:00
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:
@@ -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]):
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user