Monotone-Parent: 7d01af187554df2b24caa2526dd92eea0e8454ee
Monotone-Revision: 140cf39d8e4843502d824435239a59f459c181d7 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-04-17T14:32:47 Monotone-Branch: ca.inverse.sogomaint-2.0.2
parent
4a265cdcbd
commit
fa452e68e7
|
@ -1,5 +1,12 @@
|
|||
2007-04-17 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* SoObjects/SOGo/SOGoContentObject.m ([SOGoContentObject -acls]):
|
||||
new method to comply with the new acl "protocol" in SOGoObject.
|
||||
Uses SOGoFolder's new facilities for ACLS.
|
||||
([SOGoContentObject -aclsForUser:uid]): idem.
|
||||
([SOGoContentObject -setRoles:rolesforUser:uid]): idem.
|
||||
([SOGoContentObject -removeAclsForUsers:users]): idem.
|
||||
|
||||
* SoObjects/SOGo/SOGoFolder.m ([SOGoFolder
|
||||
-aclsForObjectAtPath:objectPathArray]): new method generic to GCS
|
||||
based folders. This method is derived from the code that was in
|
||||
|
|
|
@ -25,7 +25,9 @@
|
|||
|
||||
#import <SOGo/SOGoObject.h>
|
||||
|
||||
@class NSString, NSException;
|
||||
@class NSArray;
|
||||
@class NSException;
|
||||
@class NSString;
|
||||
|
||||
@interface SOGoContentObject : SOGoObject
|
||||
{
|
||||
|
@ -35,29 +37,29 @@
|
|||
|
||||
/* accessors */
|
||||
|
||||
- (void)setOCSPath:(NSString *)_path;
|
||||
- (NSString *)ocsPath;
|
||||
- (void) setOCSPath: (NSString *) _path;
|
||||
- (NSString *) ocsPath;
|
||||
|
||||
/* folder */
|
||||
|
||||
- (NSString *)ocsPathOfContainer;
|
||||
- (GCSFolder *)ocsFolder;
|
||||
- (NSString *) ocsPathOfContainer;
|
||||
- (GCSFolder *) ocsFolder;
|
||||
|
||||
/* content */
|
||||
|
||||
- (NSString *)contentAsString;
|
||||
- (NSException *)saveContentString:(NSString *)_str
|
||||
baseVersion:(unsigned int)_baseVersion;
|
||||
- (NSException *)saveContentString:(NSString *)_str;
|
||||
- (NSException *)delete;
|
||||
- (NSString *) contentAsString;
|
||||
- (NSException *) saveContentString: (NSString *) _str
|
||||
baseVersion: (unsigned int) _baseVersion;
|
||||
- (NSException *) saveContentString: (NSString *)_str;
|
||||
- (NSException *) delete;
|
||||
|
||||
/* etag support */
|
||||
|
||||
- (id)davEntityTag;
|
||||
- (id) davEntityTag;
|
||||
|
||||
/* message type */
|
||||
|
||||
- (NSString *)outlookMessageClass;
|
||||
- (NSString *) outlookMessageClass;
|
||||
|
||||
@end
|
||||
|
||||
|
|
|
@ -36,15 +36,15 @@
|
|||
// TODO: check superclass version
|
||||
|
||||
- (void)dealloc {
|
||||
[self->content release];
|
||||
[self->ocsPath release];
|
||||
[content release];
|
||||
[ocsPath release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
/* notifications */
|
||||
|
||||
- (void)sleep {
|
||||
[self->content release]; self->content = nil;
|
||||
[content release]; content = nil;
|
||||
[super sleep];
|
||||
}
|
||||
|
||||
|
@ -55,26 +55,26 @@
|
|||
}
|
||||
|
||||
- (void)setOCSPath:(NSString *)_path {
|
||||
if ([self->ocsPath isEqualToString:_path])
|
||||
if ([ocsPath isEqualToString:_path])
|
||||
return;
|
||||
|
||||
if (self->ocsPath)
|
||||
if (ocsPath)
|
||||
[self warnWithFormat:@"GCS path is already set! '%@'", _path];
|
||||
|
||||
ASSIGNCOPY(self->ocsPath, _path);
|
||||
ASSIGNCOPY(ocsPath, _path);
|
||||
}
|
||||
|
||||
- (NSString *)ocsPath {
|
||||
if (self->ocsPath == nil) {
|
||||
if (ocsPath == nil) {
|
||||
NSString *p;
|
||||
|
||||
if ((p = [self ocsPathOfContainer]) != nil) {
|
||||
if (![p hasSuffix:@"/"]) p = [p stringByAppendingString:@"/"];
|
||||
p = [p stringByAppendingString:[self nameInContainer]];
|
||||
self->ocsPath = [p copy];
|
||||
ocsPath = [p copy];
|
||||
}
|
||||
}
|
||||
return self->ocsPath;
|
||||
return ocsPath;
|
||||
}
|
||||
|
||||
- (NSString *)ocsPathOfContainer {
|
||||
|
@ -84,32 +84,26 @@
|
|||
return [[self container] ocsPath];
|
||||
}
|
||||
|
||||
- (GCSFolder *)ocsFolder {
|
||||
if (![[self container] respondsToSelector:@selector(ocsFolder)])
|
||||
return nil;
|
||||
|
||||
return [[self container] ocsFolder];
|
||||
- (GCSFolder *) ocsFolder
|
||||
{
|
||||
return [container ocsFolder];
|
||||
}
|
||||
|
||||
/* content */
|
||||
|
||||
- (NSString *)contentAsString {
|
||||
GCSFolder *folder;
|
||||
- (NSString *) contentAsString
|
||||
{
|
||||
if (!content)
|
||||
{
|
||||
content = [[self ocsFolder] fetchContentWithName: nameInContainer];
|
||||
[content retain];
|
||||
}
|
||||
|
||||
if (self->content != nil)
|
||||
return self->content;
|
||||
|
||||
if ((folder = [self ocsFolder]) == nil) {
|
||||
[self errorWithFormat:@"Did not find folder of content object."];
|
||||
return nil;
|
||||
}
|
||||
|
||||
self->content = [[folder fetchContentWithName:[self nameInContainer]] copy];
|
||||
return self->content;
|
||||
return content;
|
||||
}
|
||||
|
||||
- (NSException *)saveContentString:(NSString *)_str
|
||||
baseVersion:(unsigned int)_baseVersion
|
||||
- (NSException *) saveContentString: (NSString *) _str
|
||||
baseVersion: (unsigned int) _baseVersion
|
||||
{
|
||||
/* Note: "iCal multifolder saves" are implemented in the apt subclass! */
|
||||
GCSFolder *folder;
|
||||
|
@ -184,8 +178,8 @@
|
|||
@"reassigned a new location for special new-location: %@", tmp];
|
||||
|
||||
/* kinda dangerous */
|
||||
ASSIGNCOPY(self->nameInContainer, tmp);
|
||||
ASSIGN(self->ocsPath, nil);
|
||||
ASSIGNCOPY(nameInContainer, tmp);
|
||||
ASSIGN(ocsPath, nil);
|
||||
}
|
||||
|
||||
/* determine base version from etag in if-match header */
|
||||
|
@ -311,6 +305,39 @@
|
|||
return [self isFolderish];
|
||||
}
|
||||
|
||||
/* acls */
|
||||
|
||||
- (NSString *) defaultAclRoles
|
||||
{
|
||||
#warning this should be changed to something useful
|
||||
return @"tourist";
|
||||
}
|
||||
|
||||
- (NSArray *) acls
|
||||
{
|
||||
return [container aclsForObjectAtPath: [self pathArrayToSoObject]];
|
||||
}
|
||||
|
||||
- (NSArray *) aclsForUser: (NSString *) uid
|
||||
{
|
||||
return [container aclsForUser: uid
|
||||
forObjectAtPath: [self pathArrayToSoObject]];
|
||||
}
|
||||
|
||||
- (void) setRoles: (NSString *) roles
|
||||
forUser: (NSString *) uid
|
||||
{
|
||||
return [container setRoles: roles
|
||||
forUser: uid
|
||||
forObjectAtPath: [self pathArrayToSoObject]];
|
||||
}
|
||||
|
||||
- (void) removeAclsForUsers: (NSArray *) users
|
||||
{
|
||||
return [container removeAclsForUsers: users
|
||||
forObjectAtPath: [self pathArrayToSoObject]];
|
||||
}
|
||||
|
||||
/* message type */
|
||||
|
||||
- (NSString *)outlookMessageClass {
|
||||
|
|
Loading…
Reference in New Issue