Monotone-Parent: df870b4e79eda3ed7de26b0e804517afa6f1af76

Monotone-Revision: 220c4846d2f1915bcdea411cdf4c86f26e2e80ef

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2007-05-25T21:26:01
Monotone-Branch: ca.inverse.sogo
maint-2.0.2
Wolfgang Sourdeau 2007-05-25 21:26:01 +00:00
parent 95db82b21c
commit 539ac118f1
3 changed files with 96 additions and 10 deletions

View File

@ -1,5 +1,15 @@
2007-05-25 Wolfgang Sourdeau <wsourdeau@inverse.ca>
* SoObjects/Mailer/SOGoMailFolder.m ([SOGoMailFolder
-ownerInContext:localContext]): overriden method because we are an
IMAP4 client and we need a bit more intelligence to deduce the
owner of the current folder.
([SOGoMailFolder -aclsForUser:uid]): aclForMailboxAtURL might
return an NSException so we need to be careful here to avoid a
crash.
([SOGoMailFolder -aclUsers]): aclForMailboxAtURL might return an
NSException so we need to be careful here to avoid a crash.
* SoObjects/Mailer/SOGoMailAccounts.m
([SOGoMailAccounts -fetchIdentitiesWithOnlyEmitterAccess:_flag])
there is no longer any concept of Intranet or Internet connection

View File

@ -420,24 +420,71 @@ static BOOL useAltNamespace = NO;
- (NSArray *) aclUsers
{
NSArray *users;
NSDictionary *imapAcls;
imapAcls = [imap4 aclForMailboxAtURL: [self imap4URL]];
if ([imapAcls isKindOfClass: [NSDictionary class]])
users = [imapAcls allKeys];
else
users = nil;
return [imapAcls allKeys];
return users;
}
- (NSMutableArray *) _sharesACLs
{
NSMutableArray *acls;
SOGoMailAccount *mailAccount;
NSString *path, *sharedPath, *othersPath;
NSArray *names;
unsigned int count;
acls = [NSMutableArray array];
mailAccount = [self mailAccountFolder];
sharedPath = [NSString stringWithFormat: @"/%@",
[mailAccount sharedFolderName]];
othersPath = [NSString stringWithFormat: @"/%@",
[mailAccount otherUsersFolderName]];
path = [[self imap4URL] path];
names = [path componentsSeparatedByString: @"/"];
count = [names count];
if ([path hasPrefix: sharedPath])
{
if (count == 2)
[acls addObject: SOGoRole_ObjectViewer];
}
else if ([path hasPrefix: othersPath])
{
if (count == 2 || count == 3)
[acls addObject: SOGoRole_ObjectViewer];
}
else
[acls addObject: SoRole_Owner];
return acls;
}
- (NSArray *) aclsForUser: (NSString *) uid
{
NSDictionary *imapAcls;
NSMutableArray *acls;
NSString *userAcls;
acls = [self _sharesACLs];
imapAcls = [imap4 aclForMailboxAtURL: [self imap4URL]];
userAcls = [imapAcls objectForKey: uid];
if (!([userAcls length] || [uid isEqualToString: defaultUserID]))
userAcls = [imapAcls objectForKey: defaultUserID];
if ([imapAcls isKindOfClass: [NSDictionary class]])
{
userAcls = [imapAcls objectForKey: uid];
if (!([userAcls length] || [uid isEqualToString: defaultUserID]))
userAcls = [imapAcls objectForKey: defaultUserID];
if ([userAcls length])
[acls addObjectsFromArray: [self _imapAclsToSOGoAcls: userAcls]];
}
return [self _imapAclsToSOGoAcls: userAcls];
return acls;
}
- (void) removeAclsForUsers: (NSArray *) users
@ -474,6 +521,35 @@ static BOOL useAltNamespace = NO;
return defaultUserID;
}
- (NSString *) ownerInContext: (WOContext *) localContext
{
SOGoMailAccount *mailAccount;
NSString *path, *sharedPath, *othersPath, *owner;
NSArray *names;
mailAccount = [self mailAccountFolder];
sharedPath = [NSString stringWithFormat: @"/%@",
[mailAccount sharedFolderName]];
othersPath = [NSString stringWithFormat: @"/%@",
[mailAccount otherUsersFolderName]];
path = [[self imap4URL] path];
if (sharedPath && [path hasPrefix: sharedPath])
owner = @"anyone";
else if (othersPath && [path hasPrefix: othersPath])
{
names = [path componentsSeparatedByString: @"/"];
if ([names count] > 2)
owner = [names objectAtIndex: 2];
else
owner = @"anyone";
}
else
owner = [super ownerInContext: localContext];
return owner;
}
- (BOOL) hasSupportForDefaultRoles
{
return YES;

View File

@ -41,13 +41,13 @@
SOGoMailFolder = {
superclass = "SOGoMailBaseObject";
defaultRoles = {
"View" = ( "Owner", "AuthorizedSubscriber" );
"Access Contents Information" = ( "Owner", "AuthorizedSubscriber" );
"View" = ( "Owner", "ObjectViewer" );
"Access Contents Information" = ( "Owner", "ObjectReader" );
"Add Documents, Images, and Files" = ( "Owner", "ObjectCreator" );
"Delete Objects" = ( "Owner", "ObjectEraser" );
"WebDAV Access" = ( "Owner", "AuthorizedSubscriber" );
"ReadAcls" = ( "Owner", "AuthorizedSubscriber" );
"SaveAcls" = ( "Owner" );
"WebDAV Access" = ( "Owner", "ObjectViewer" );
"ReadAcls" = ( "Owner", "ObjectViewer" );
"SaveAcls" = ( "Owner", "MailAdministrator" );
};
};
SOGoSharedInboxFolder = {