Monotone-Parent: f6d4ca8944c94273bc0dae0565c60e45be9f2ca1

Monotone-Revision: 98896091d472e0ee7990f69f32f5981f5d1dc546

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2008-01-16T18:46:32
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau
2008-01-16 18:46:32 +00:00
parent d0db04a31e
commit 8aae87afd5
16 changed files with 508 additions and 129 deletions
@@ -48,6 +48,7 @@
#import <SaxObjC/XMLNamespaces.h>
// #import <NGObjWeb/SoClassSecurityInfo.h>
#import <SOGo/SOGoCache.h>
#import <SOGo/SOGoCustomGroupFolder.h>
#import <SOGo/LDAPUserManager.h>
#import <SOGo/SOGoPermissions.h>
@@ -299,8 +300,8 @@ static NSNumber *sharedYes = nil;
[r setStatus: 207];
[r setContentEncoding: NSUTF8StringEncoding];
[r setHeader: @"text/xml; charset=\"utf-8\"" forKey: @"content-type"];
[r setHeader: @"no-cache" forKey: @"pragma"];
[r setHeader: @"no-cache" forKey: @"cache-control"];
// [r setHeader: @"no-cache" forKey: @"pragma"];
// [r setHeader: @"no-cache" forKey: @"cache-control"];
[r appendContentString:@"<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n"];
[r appendContentString: @"<D:multistatus xmlns:D=\"DAV:\""
@" xmlns:C=\"urn:ietf:params:xml:ns:caldav\">\r\n"];
@@ -403,6 +404,11 @@ static NSNumber *sharedYes = nil;
obj = [NSException exceptionWithHTTPStatus:404 /* Not Found */];
}
if (obj)
[[SOGoCache sharedCache] registerObject: obj
withName: _key
inContainer: container];
return obj;
}
@@ -126,7 +126,7 @@ static BOOL sendEMailNotifications = NO;
sm = [SoSecurityManager sharedSecurityManager];
if (![sm validatePermission: SOGoCalendarPerm_ViewAllComponent
onObject: self inContext: context])
iCalString = content;
iCalString = [record objectForKey: @"c_content"];
else if (![sm validatePermission: SOGoCalendarPerm_ViewDAndT
onObject: self inContext: context])
{
@@ -165,7 +165,7 @@ static BOOL sendEMailNotifications = NO;
if (secure)
iCalString = [self secureContentAsString];
else
iCalString = content;
iCalString = [record objectForKey: @"c_content"];
if ([iCalString length] > 0)
calendar = [iCalCalendar parseSingleFromSource: iCalString];
+3
View File
@@ -48,8 +48,11 @@
- (NGVCard *) vCard
{
NSString *content;
if (!card)
{
content = [record objectForKey: @"c_content"];
if ([[content uppercaseString] hasPrefix: @"BEGIN:VCARD"])
card = [NGVCard parseSingleFromSource: content];
else
+1 -1
View File
@@ -104,7 +104,7 @@ static NSString *AgenorShareLoginMarker = @".-.";
/* first check attributes directly bound to the application */
if ((obj = [super lookupName:_key inContext:_ctx acquire:NO]))
return obj;
if (![self isInHomeFolderBranchOfLoggedInAccount: userLogin]) {
[self warnWithFormat:@ "User %@ tried to access mail hierarchy of %@",
userLogin, [container nameInContainer]];
+1 -1
View File
@@ -850,7 +850,7 @@ static BOOL debugSoParts = NO;
}
else
clazz = Nil;
return [clazz objectWithName:_key inContainer: self];
}
+2
View File
@@ -20,6 +20,7 @@ libSOGo_HEADER_FILES_INSTALL_DIR = /SOGo
FHS_HEADER_DIRS = SOGo
libSOGo_HEADER_FILES = \
SOGoCache.h \
SOGoObject.h \
SOGoContentObject.h \
SOGoFolder.h \
@@ -56,6 +57,7 @@ libSOGo_HEADER_FILES = \
WORequest+SOGo.h
libSOGo_OBJC_FILES = \
SOGoCache.m \
SOGoObject.m \
SOGoContentObject.m \
SOGoFolder.m \
+1 -1
View File
@@ -31,7 +31,7 @@
@interface SOGoContentObject : SOGoObject
{
NSString *ocsPath;
NSString *content;
NSDictionary *record;
BOOL isNew;
}
+21 -20
View File
@@ -49,9 +49,9 @@
if ((self = [super initWithName: newName inContainer: newContainer]))
{
ocsPath = nil;
content = [[self ocsFolder] fetchContentWithName: newName];
[content retain];
isNew = (!content);
record = [[self ocsFolder] recordOfEntryWithName: newName];
[record retain];
isNew = (!record);
}
return self;
@@ -59,19 +59,11 @@
- (void) dealloc
{
[content release];
[record release];
[ocsPath release];
[super dealloc];
}
/* notifications */
- (void) sleep
{
[content release]; content = nil;
[super sleep];
}
/* accessors */
- (BOOL) isFolderish
@@ -136,19 +128,25 @@
- (NSString *) contentAsString
{
return content;
return [record objectForKey: @"c_content"];
}
- (NSException *) saveContentString: (NSString *) newContent
baseVersion: (unsigned int) newBaseVersion
{
/* Note: "iCal multifolder saves" are implemented in the apt subclass! */
GCSFolder *folder;
GCSFolder *folder;
NSException *ex;
NSMutableDictionary *newRecord;
ex = nil;
ASSIGN (content, newContent);
if (record)
newRecord = [NSMutableDictionary dictionaryWithDictionary: record];
else
newRecord = [NSMutableDictionary dictionary];
[newRecord setObject: newContent forKey: @"c_content"];
ASSIGN (record, newRecord);
folder = [container ocsFolder];
if (folder)
@@ -307,7 +305,7 @@
folder = [self ocsFolder];
if (folder)
{
versionValue = [folder versionOfContentWithName: [self nameInContainer]];
versionValue = [record objectForKey: @"c_version"];
sprintf (buf, "\"gcs%08d\"", [versionValue unsignedIntValue]);
entityTag = [NSString stringWithCString: buf];
}
@@ -325,7 +323,7 @@
{
NSCalendarDate *date;
date = [[self ocsFolder] creationDateOfEntryWithName: nameInContainer];
date = [record objectForKey: @"c_creationdate"];
return [date rfc822DateString];
}
@@ -334,16 +332,19 @@
{
NSCalendarDate *date;
date = [[self ocsFolder] lastModificationOfEntryWithName: nameInContainer];
date = [record objectForKey: @"c_lastmodified"];
return [date rfc822DateString];
}
- (NSString *) davContentLength
{
NSString *content;
content = [record objectForKey: @"c_content"];
return [NSString stringWithFormat: @"%u",
[content
lengthOfBytesUsingEncoding: NSISOLatin1StringEncoding]];
[content lengthOfBytesUsingEncoding: NSISOLatin1StringEncoding]];
}
- (NSException *) davMoveToTargetObject: (id) _target
+13 -3
View File
@@ -62,6 +62,7 @@
#import "NSDictionary+Utilities.h"
#import "NSString+Utilities.h"
#import "SOGoCache.h"
#import "SOGoObject.h"
@interface SOGoObject(Content)
@@ -560,10 +561,19 @@ static BOOL kontactGroupDAV = YES;
acquire: (BOOL) acquire
{
id obj;
SOGoCache *cache;
obj = [[self soClass] lookupKey: lookupName inContext: localContext];
if (obj)
[obj bindToObject: self inContext: localContext];
cache = [SOGoCache sharedCache];
obj = [cache objectNamed: lookupName inContainer: self];
if (!obj)
{
obj = [[self soClass] lookupKey: lookupName inContext: localContext];
if (obj)
{
[obj bindToObject: self inContext: localContext];
[cache registerObject: obj withName: lookupName inContainer: self];
}
}
return obj;
}
+17 -3
View File
@@ -32,10 +32,11 @@
#import "AgenorUserDefaults.h"
#import "LDAPUserManager.h"
#import "NSArray+Utilities.h"
#import "SOGoCache.h"
#import "SOGoDateFormatter.h"
#import "SOGoObject.h"
#import "SOGoPermissions.h"
#import "NSArray+Utilities.h"
#import "SOGoUser.h"
@@ -124,10 +125,18 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
+ (SOGoUser *) userWithLogin: (NSString *) newLogin
roles: (NSArray *) newRoles
{
SOGoCache *cache;
SOGoUser *user;
user = [[self alloc] initWithLogin: newLogin roles: newRoles];
[user autorelease];
cache = [SOGoCache sharedCache];
user = [cache userNamed: newLogin];
if (!user)
{
user = [[self alloc] initWithLogin: newLogin roles: newRoles];
[user autorelease];
[cache registerUser: user];
}
[user setPrimaryRoles: newRoles];
return user;
}
@@ -181,6 +190,11 @@ NSString *SOGoWeekStartFirstFullWeek = @"FirstFullWeek";
[super dealloc];
}
- (void) setPrimaryRoles: (NSArray *) newRoles
{
ASSIGN (roles, newRoles);
}
- (void) setCurrentPassword: (NSString *) newPassword
{
ASSIGN (currentPassword, newPassword);