From ad5ddda257040484e8d9b5cf4aaba46351c6a38b Mon Sep 17 00:00:00 2001 From: helge Date: Fri, 15 Jul 2005 07:31:57 +0000 Subject: [PATCH] added support for more permission flags git-svn-id: http://svn.opengroupware.org/SOGo/trunk@771 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/SoObjects/Mailer/ChangeLog | 5 ++++ SOGo/SoObjects/Mailer/SOGoMailFolder.h | 14 ++++++++- SOGo/SoObjects/Mailer/SOGoMailFolder.m | 41 ++++++++++++++++++++++++-- SOGo/SoObjects/Mailer/Version | 2 +- 4 files changed, 57 insertions(+), 5 deletions(-) diff --git a/SOGo/SoObjects/Mailer/ChangeLog b/SOGo/SoObjects/Mailer/ChangeLog index 4dc22242..b75a01c9 100644 --- a/SOGo/SoObjects/Mailer/ChangeLog +++ b/SOGo/SoObjects/Mailer/ChangeLog @@ -1,3 +1,8 @@ +2005-07-15 Helge Hess + + * SOGoMailFolder.m: added support for more Cyrus permission flags + (v0.9.105) + 2005-07-15 Helge Hess * SOGoMailObject.m, SOGoMailBodyPart.m, SOGoDraftObject.m: fixed gcc4.0 diff --git a/SOGo/SoObjects/Mailer/SOGoMailFolder.h b/SOGo/SoObjects/Mailer/SOGoMailFolder.h index 3da76ac7..6d9e3c25 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailFolder.h +++ b/SOGo/SoObjects/Mailer/SOGoMailFolder.h @@ -44,7 +44,13 @@ struct { int didCheckMyRights:1; int isDeleteAndExpungeAllowed:1; - int reserved:30; + int isReadAllowed:1; + int isWriteAllowed:1; + int isInsertAllowed:1; + int isPostAllowed:1; + int isCreateAllowed:1; + int hasAdminAccess:1; + int reserved:24; } somfFlags; } @@ -60,6 +66,12 @@ /* permissions */ - (BOOL)isDeleteAndExpungeAllowed; +- (BOOL)isReadAllowed; +- (BOOL)isWriteAllowed; +- (BOOL)isInsertAllowed; +- (BOOL)isPostAllowed; +- (BOOL)isCreateAllowed; +- (BOOL)hasAdminAccess; /* flags */ diff --git a/SOGo/SoObjects/Mailer/SOGoMailFolder.m b/SOGo/SoObjects/Mailer/SOGoMailFolder.m index e88885a7..55336552 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailFolder.m +++ b/SOGo/SoObjects/Mailer/SOGoMailFolder.m @@ -108,6 +108,7 @@ - (void)_loadACLPermissionFlags { NSString *rights; + unsigned i, len; if (self->somfFlags.didCheckMyRights) return; @@ -119,13 +120,47 @@ } self->somfFlags.didCheckMyRights = 1; - self->somfFlags.isDeleteAndExpungeAllowed = - [rights rangeOfString:@"d"].length > 0 ? 1 : 0; + + for (i = 0, len = [rights length]; i < len; i++) { + switch ([rights characterAtIndex:i]) { + case 'd': self->somfFlags.isDeleteAndExpungeAllowed = 1; + case 'r': self->somfFlags.isReadAllowed = 1; + case 'w': self->somfFlags.isWriteAllowed = 1; + case 'i': self->somfFlags.isInsertAllowed = 1; + case 'p': self->somfFlags.isPostAllowed = 1; + case 'c': self->somfFlags.isCreateAllowed = 1; + case 'a': self->somfFlags.hasAdminAccess = 1; + } + } } - (BOOL)isDeleteAndExpungeAllowed { [self _loadACLPermissionFlags]; - return self->somfFlags.isDeleteAndExpungeAllowed; + return self->somfFlags.isDeleteAndExpungeAllowed ? YES : NO; +} +- (BOOL)isReadAllowed { + [self _loadACLPermissionFlags]; + return self->somfFlags.isReadAllowed ? YES : NO; +} +- (BOOL)isWriteAllowed { + [self _loadACLPermissionFlags]; + return self->somfFlags.isWriteAllowed ? YES : NO; +} +- (BOOL)isInsertAllowed { + [self _loadACLPermissionFlags]; + return self->somfFlags.isInsertAllowed ? YES : NO; +} +- (BOOL)isPostAllowed { + [self _loadACLPermissionFlags]; + return self->somfFlags.isPostAllowed ? YES : NO; +} +- (BOOL)isCreateAllowed { + [self _loadACLPermissionFlags]; + return self->somfFlags.isCreateAllowed ? YES : NO; +} +- (BOOL)hasAdminAccess { + [self _loadACLPermissionFlags]; + return self->somfFlags.hasAdminAccess ? YES : NO; } /* messages */ diff --git a/SOGo/SoObjects/Mailer/Version b/SOGo/SoObjects/Mailer/Version index f1a4f532..8aee7a07 100644 --- a/SOGo/SoObjects/Mailer/Version +++ b/SOGo/SoObjects/Mailer/Version @@ -1,6 +1,6 @@ # Version file -SUBMINOR_VERSION:=104 +SUBMINOR_VERSION:=105 # v0.9.96 requires libNGMime v4.5.223 # v0.9.91 requires libNGMime v4.5.222 -- 2.39.5