]> err.no Git - scalable-opengroupware.org/commitdiff
added support for more permission flags
authorhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 15 Jul 2005 07:31:57 +0000 (07:31 +0000)
committerhelge <helge@d1b88da0-ebda-0310-925b-ed51d893ca5b>
Fri, 15 Jul 2005 07:31:57 +0000 (07:31 +0000)
git-svn-id: http://svn.opengroupware.org/SOGo/trunk@771 d1b88da0-ebda-0310-925b-ed51d893ca5b

SOGo/SoObjects/Mailer/ChangeLog
SOGo/SoObjects/Mailer/SOGoMailFolder.h
SOGo/SoObjects/Mailer/SOGoMailFolder.m
SOGo/SoObjects/Mailer/Version

index 4dc2224213bb0e32fc00762603639f1f34e736ab..b75a01c99a3e7721d36dfe8ecc0f9d5b66de66bc 100644 (file)
@@ -1,3 +1,8 @@
+2005-07-15  Helge Hess  <helge.hess@opengroupware.org>
+
+       * SOGoMailFolder.m: added support for more Cyrus permission flags
+         (v0.9.105)
+
 2005-07-15  Helge Hess  <helge.hess@opengroupware.org>
 
        * SOGoMailObject.m, SOGoMailBodyPart.m, SOGoDraftObject.m: fixed gcc4.0
index 3da76ac7440ae6391b5bf97ad6a399d93fd1f78f..6d9e3c250aea224273c63809670f2c332e4e8452 100644 (file)
   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;
 }
 
 /* permissions */
 
 - (BOOL)isDeleteAndExpungeAllowed;
+- (BOOL)isReadAllowed;
+- (BOOL)isWriteAllowed;
+- (BOOL)isInsertAllowed;
+- (BOOL)isPostAllowed;
+- (BOOL)isCreateAllowed;
+- (BOOL)hasAdminAccess;
 
 /* flags */
 
index e88885a79f9e2c797339fca387e9d390e4a711ee..55336552e3b97323b991d05e6e3dc4bc3f7c2b6a 100644 (file)
 
 - (void)_loadACLPermissionFlags {
   NSString *rights;
+  unsigned i, len;
   
   if (self->somfFlags.didCheckMyRights)
     return;
   }
   
   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 */
index f1a4f532215e434bc8137d316b646508d98e52b4..8aee7a07906413464b0613f4f4d2d3e574b41714 100644 (file)
@@ -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