- (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 */