From: helge Date: Tue, 19 Jul 2005 13:16:36 +0000 (+0000) Subject: proper handling of mailbox creation with altnamespace (#1472) X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8843175fd096ef65ff32a31f794e8f4af55e9ec5;p=scalable-opengroupware.org proper handling of mailbox creation with altnamespace (#1472) git-svn-id: http://svn.opengroupware.org/SOGo/trunk@826 d1b88da0-ebda-0310-925b-ed51d893ca5b --- diff --git a/SOGo/SoObjects/Mailer/ChangeLog b/SOGo/SoObjects/Mailer/ChangeLog index b23b9809..afb810e9 100644 --- a/SOGo/SoObjects/Mailer/ChangeLog +++ b/SOGo/SoObjects/Mailer/ChangeLog @@ -1,5 +1,9 @@ 2005-07-19 Helge Hess + * SOGoMailFolder.m: report NO in -isCreateAllowed when the folder is + the INBOX and SOGoSpecialFoldersInRoot (altnamespace) is enabled + (#1472) (v0.9.112) + * SOGoDraftObject.m: made 'SOGoInternetMailSuffix' a pattern which can access request values (v0.9.111) diff --git a/SOGo/SoObjects/Mailer/SOGoMailFolder.h b/SOGo/SoObjects/Mailer/SOGoMailFolder.h index 6d9e3c25..ce49d2a4 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailFolder.h +++ b/SOGo/SoObjects/Mailer/SOGoMailFolder.h @@ -77,6 +77,10 @@ - (NSException *)addFlagsToAllMessages:(id)_f; +/* folder type */ + +- (NSString *)outlookFolderClass; + @end #endif /* __Mailer_SOGoMailFolder_H__ */ diff --git a/SOGo/SoObjects/Mailer/SOGoMailFolder.m b/SOGo/SoObjects/Mailer/SOGoMailFolder.m index 60b300ae..429554a8 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailFolder.m +++ b/SOGo/SoObjects/Mailer/SOGoMailFolder.m @@ -29,14 +29,20 @@ @implementation SOGoMailFolder +static BOOL useAltNamespace = NO; + + (int)version { return [super version] + 0 /* v1 */; } + (void)initialize { + NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; + NSAssert2([super version] == 1, @"invalid superclass (%@) version %i !", NSStringFromClass([self superclass]), [super version]); + + useAltNamespace = [ud boolForKey:@"SOGoSpecialFoldersInRoot"]; } - (void)dealloc { @@ -175,10 +181,21 @@ [self _loadACLPermissionFlags]; return self->somfFlags.isPostAllowed ? YES : NO; } -- (BOOL)isCreateAllowed { + +- (BOOL)isCreateAllowedInACL { + /* we call this directly from UIxMailAccountView */ [self _loadACLPermissionFlags]; return self->somfFlags.isCreateAllowed ? YES : NO; } +- (BOOL)isCreateAllowed { + if (useAltNamespace) { + /* with altnamespace, Cyrus doesn't allow mailboxes under INBOX */ + if ([[self outlookFolderClass] isEqualToString:@"IPF.Inbox"]) + return NO; + } + return [self isCreateAllowedInACL]; +} + - (BOOL)hasAdminAccess { [self _loadACLPermissionFlags]; return self->somfFlags.hasAdminAccess ? YES : NO; diff --git a/SOGo/SoObjects/Mailer/Version b/SOGo/SoObjects/Mailer/Version index 6d6868c7..493dfefc 100644 --- a/SOGo/SoObjects/Mailer/Version +++ b/SOGo/SoObjects/Mailer/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=111 +SUBMINOR_VERSION:=112 # v0.9.111 requires libNGExtensions v4.5.163 # v0.9.96 requires libNGMime v4.5.223 diff --git a/SOGo/UI/MailerUI/ChangeLog b/SOGo/UI/MailerUI/ChangeLog index 40d15704..affdf4fc 100644 --- a/SOGo/UI/MailerUI/ChangeLog +++ b/SOGo/UI/MailerUI/ChangeLog @@ -1,3 +1,9 @@ +2005-07-19 Helge Hess + + * UIxMailAccountView.m: directly check the ACL of the Inbox to check + permissions (the Inbox will return NO on isCreateAllowed when being + used by altnamespace ...) (#1472) (v0.9.153) + 2005-07-19 Marcus Mueller * UIxMailAddressbook.m: don't restrict the Anais 'nature' flag anymore diff --git a/SOGo/UI/MailerUI/UIxMailAccountView.m b/SOGo/UI/MailerUI/UIxMailAccountView.m index b3aeb7cf..9df7fbe4 100644 --- a/SOGo/UI/MailerUI/UIxMailAccountView.m +++ b/SOGo/UI/MailerUI/UIxMailAccountView.m @@ -38,6 +38,10 @@ @end +@interface SOGoMailFolder(UsedPrivates) +- (BOOL)isCreateAllowedInACL; +@end + @implementation UIxMailAccountView static BOOL useAltNamespace = NO; @@ -106,7 +110,7 @@ static BOOL useAltNamespace = NO; return NO; } - return [self->inbox isCreateAllowed]; + return [self->inbox isCreateAllowedInACL]; } /* error redirects */ diff --git a/SOGo/UI/MailerUI/product.plist b/SOGo/UI/MailerUI/product.plist index 6efeec2f..099c97a8 100644 --- a/SOGo/UI/MailerUI/product.plist +++ b/SOGo/UI/MailerUI/product.plist @@ -121,7 +121,7 @@ isSafe = NO; cssClass = "tbicon_folderadd"; label = "Create"; }, { link = "#"; onclick="return ctxFolderDelete(this)"; - enabled = "clientObject.isCreateAllowed"; + enabled = "clientObject.isCreateAllowed"; // TODO: correct? isSafe = NO; cssClass = "tbicon_folderdel"; label = "Delete"; }, ),