2012-06-29 19:59:38 +02:00
|
|
|
/* MAPIStoreDBFolder.m - this file is part of SOGo
|
2011-02-24 21:32:27 +01:00
|
|
|
*
|
2012-08-17 21:04:57 +02:00
|
|
|
* Copyright (C) 2011-2012 Inverse inc
|
2011-02-24 21:32:27 +01:00
|
|
|
*
|
|
|
|
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
|
|
|
*
|
|
|
|
* This file is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
2011-08-12 17:02:01 +02:00
|
|
|
* the Free Software Foundation; either version 3, or (at your option)
|
2011-02-24 21:32:27 +01:00
|
|
|
* any later version.
|
|
|
|
*
|
|
|
|
* This file is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; see the file COPYING. If not, write to
|
|
|
|
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
* Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
|
2016-02-17 16:09:18 +01:00
|
|
|
#include <inttypes.h>
|
2011-06-23 15:57:09 +02:00
|
|
|
|
2016-02-17 16:09:18 +01:00
|
|
|
#import <Foundation/NSArray.h>
|
|
|
|
#import <Foundation/NSCalendarDate.h>
|
|
|
|
#import <Foundation/NSDictionary.h>
|
|
|
|
#import <Foundation/NSException.h>
|
|
|
|
#import <Foundation/NSString.h>
|
|
|
|
#import <Foundation/NSURL.h>
|
2011-02-24 21:32:27 +01:00
|
|
|
#import <NGExtensions/NSObject+Logs.h>
|
2016-02-17 16:09:18 +01:00
|
|
|
#import <EOControl/EOQualifier.h>
|
|
|
|
#import <SOGo/SOGoFolder.h>
|
|
|
|
#import <SOGo/SOGoUser.h>
|
2014-05-14 03:06:59 +02:00
|
|
|
#import <SOGo/EOQualifier+SOGoCacheObject.h>
|
2016-02-17 16:09:18 +01:00
|
|
|
#import "MAPIStoreContext.h"
|
|
|
|
#import "MAPIStoreDBFolderTable.h"
|
|
|
|
#import "MAPIStoreDBMessage.h"
|
|
|
|
#import "MAPIStoreDBMessageTable.h"
|
|
|
|
#import "MAPIStoreMapping.h"
|
|
|
|
#import "MAPIStoreTypes.h"
|
|
|
|
#import "MAPIStoreUserContext.h"
|
|
|
|
#import <SOGo/SOGoCacheGCSFolder.h>
|
|
|
|
#import "SOGoMAPIDBMessage.h"
|
2011-02-24 21:32:27 +01:00
|
|
|
|
2016-02-17 16:09:18 +01:00
|
|
|
#import "MAPIStoreDBFolder.h"
|
2011-02-24 21:32:27 +01:00
|
|
|
|
|
|
|
#undef DEBUG
|
2016-02-17 16:09:18 +01:00
|
|
|
#include <mapistore/mapistore.h>
|
|
|
|
#include <mapistore/mapistore_errors.h>
|
2011-02-24 21:32:27 +01:00
|
|
|
|
2014-05-14 12:56:05 +02:00
|
|
|
static Class EOKeyValueQualifierK, SOGoCacheGCSFolderK, MAPIStoreDBFolderK;
|
2011-02-24 21:32:27 +01:00
|
|
|
|
2011-12-02 00:02:45 +01:00
|
|
|
static NSString *MAPIStoreRightReadItems = @"RightsReadItems";
|
|
|
|
static NSString *MAPIStoreRightCreateItems = @"RightsCreateItems";
|
|
|
|
static NSString *MAPIStoreRightEditOwn = @"RightsEditOwn";
|
|
|
|
static NSString *MAPIStoreRightEditAll = @"RightsEditAll";
|
|
|
|
static NSString *MAPIStoreRightDeleteOwn = @"RightsDeleteOwn";
|
|
|
|
static NSString *MAPIStoreRightDeleteAll = @"RightsDeleteAll";
|
|
|
|
static NSString *MAPIStoreRightCreateSubfolders = @"RightsCreateSubfolders";
|
|
|
|
static NSString *MAPIStoreRightFolderOwner = @"RightsFolderOwner";
|
|
|
|
static NSString *MAPIStoreRightFolderContact = @"RightsFolderContact";
|
|
|
|
|
2012-06-29 19:59:38 +02:00
|
|
|
@implementation MAPIStoreDBFolder
|
2011-02-24 21:32:27 +01:00
|
|
|
|
|
|
|
+ (void) initialize
|
|
|
|
{
|
2011-08-12 00:56:04 +02:00
|
|
|
EOKeyValueQualifierK = [EOKeyValueQualifier class];
|
2014-05-14 12:56:05 +02:00
|
|
|
SOGoCacheGCSFolderK = [SOGoCacheGCSFolder class];
|
2012-08-13 21:40:22 +02:00
|
|
|
MAPIStoreDBFolderK = [MAPIStoreDBFolder class];
|
2011-02-24 21:32:27 +01:00
|
|
|
}
|
|
|
|
|
2012-06-29 19:59:38 +02:00
|
|
|
- (void) setupAuxiliaryObjects
|
|
|
|
{
|
|
|
|
[super setupAuxiliaryObjects];
|
|
|
|
ASSIGN (sogoObject, dbFolder);
|
|
|
|
}
|
|
|
|
|
2011-02-24 21:32:27 +01:00
|
|
|
- (MAPIStoreMessageTable *) messageTable
|
|
|
|
{
|
2012-06-29 19:59:38 +02:00
|
|
|
return [MAPIStoreDBMessageTable tableForContainer: self];
|
2011-02-24 21:32:27 +01:00
|
|
|
}
|
|
|
|
|
2011-08-12 00:56:04 +02:00
|
|
|
- (MAPIStoreFolderTable *) folderTable
|
|
|
|
{
|
2012-06-29 19:59:38 +02:00
|
|
|
return [MAPIStoreDBFolderTable tableForContainer: self];
|
2011-08-12 00:56:04 +02:00
|
|
|
}
|
|
|
|
|
2012-02-03 16:05:19 +01:00
|
|
|
- (enum mapistore_error) createFolder: (struct SRow *) aRow
|
|
|
|
withFID: (uint64_t) newFID
|
|
|
|
andKey: (NSString **) newKeyP
|
2011-06-07 02:17:46 +02:00
|
|
|
{
|
2012-07-20 17:44:25 +02:00
|
|
|
enum mapistore_error rc;
|
|
|
|
NSString *folderName, *nameInContainer;
|
2014-05-14 12:56:05 +02:00
|
|
|
SOGoCacheGCSFolder *newFolder;
|
2012-07-20 17:44:25 +02:00
|
|
|
struct SPropValue *value;
|
|
|
|
|
|
|
|
value = get_SPropValue_SRow (aRow, PidTagDisplayName);
|
|
|
|
if (value)
|
|
|
|
folderName = [NSString stringWithUTF8String: value->value.lpszW];
|
|
|
|
else
|
|
|
|
{
|
|
|
|
value = get_SPropValue_SRow (aRow, PidTagDisplayName_string8);
|
|
|
|
if (value)
|
2015-12-30 15:22:08 +01:00
|
|
|
folderName = [NSString stringWithUTF8String: (const char *) value->value.lpszA];
|
2012-07-20 17:44:25 +02:00
|
|
|
else
|
|
|
|
folderName = nil;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (folderName)
|
|
|
|
{
|
|
|
|
nameInContainer = [NSString stringWithFormat: @"0x%.16"PRIx64,
|
|
|
|
(unsigned long long) newFID];
|
2014-05-14 12:56:05 +02:00
|
|
|
newFolder = [SOGoCacheGCSFolderK objectWithName: nameInContainer
|
2012-07-20 17:44:25 +02:00
|
|
|
inContainer: sogoObject];
|
2012-07-25 19:44:35 +02:00
|
|
|
[newFolder reloadIfNeeded];
|
2012-07-20 17:44:25 +02:00
|
|
|
[[newFolder properties] setObject: folderName
|
|
|
|
forKey: MAPIPropertyKey (PidTagDisplayName)];
|
|
|
|
[newFolder save];
|
|
|
|
*newKeyP = nameInContainer;
|
|
|
|
rc = MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
rc = MAPISTORE_ERR_INVALID_PARAMETER;
|
2011-06-07 02:17:46 +02:00
|
|
|
|
2012-07-20 17:44:25 +02:00
|
|
|
return rc;
|
2011-06-07 02:17:46 +02:00
|
|
|
}
|
|
|
|
|
2012-08-15 03:02:08 +02:00
|
|
|
- (enum mapistore_error) moveCopyToFolder: (MAPIStoreFolder *) targetFolder
|
|
|
|
withNewName: (NSString *) newFolderName
|
|
|
|
isMove: (BOOL) isMove
|
|
|
|
isRecursive: (BOOL) isRecursive
|
2012-12-07 19:30:50 +01:00
|
|
|
inMemCtx: (TALLOC_CTX *) memCtx
|
2012-08-13 21:40:22 +02:00
|
|
|
{
|
|
|
|
enum mapistore_error rc;
|
|
|
|
NSString *path, *pathComponent, *targetPath, *newPath;
|
|
|
|
NSString *newURL;
|
|
|
|
MAPIStoreMapping *mapping;
|
|
|
|
NSRange slashRange;
|
|
|
|
|
2015-01-19 15:35:44 +01:00
|
|
|
pathComponent = nil;
|
|
|
|
|
2015-02-05 23:49:59 +01:00
|
|
|
if (isMove && ([targetFolder isKindOfClass: MAPIStoreDBFolderK] || !targetFolder))
|
2012-08-13 21:40:22 +02:00
|
|
|
{
|
|
|
|
path = [sogoObject path];
|
|
|
|
slashRange = [path rangeOfString: @"/" options: NSBackwardsSearch];
|
|
|
|
if (slashRange.location == NSNotFound)
|
|
|
|
[NSException raise: @"MAPIStoreIOException"
|
|
|
|
format: @"db folder path must start with a '/'"];
|
|
|
|
else
|
|
|
|
pathComponent = [path substringFromIndex: slashRange.location + 1];
|
2015-02-05 23:49:59 +01:00
|
|
|
|
|
|
|
if (targetFolder)
|
|
|
|
{
|
|
|
|
targetPath = [[targetFolder sogoObject] path];
|
|
|
|
newPath = [NSString stringWithFormat: @"%@/%@",
|
|
|
|
targetPath, pathComponent];
|
|
|
|
[dbFolder changePathTo: newPath
|
|
|
|
intoNewContainer: [targetFolder dbFolder]];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
[dbFolder changePathTo: [NSString stringWithFormat: @"/fallback/%@", pathComponent]
|
|
|
|
intoNewContainer: nil];
|
2015-08-03 15:16:55 +02:00
|
|
|
|
2012-08-13 21:40:22 +02:00
|
|
|
mapping = [self mapping];
|
2015-02-05 23:49:59 +01:00
|
|
|
|
|
|
|
if (targetFolder)
|
|
|
|
newURL = [NSString stringWithFormat: @"%@%@/",
|
|
|
|
[targetFolder url], pathComponent];
|
|
|
|
else
|
|
|
|
newURL = [NSString stringWithFormat: @"sogo://%@@fallback/%@/",
|
|
|
|
[[self userContext] username], pathComponent];
|
|
|
|
|
2012-08-13 21:40:22 +02:00
|
|
|
[mapping updateID: [self objectId]
|
|
|
|
withURL: newURL];
|
|
|
|
|
2012-08-15 15:13:15 +02:00
|
|
|
[targetFolder cleanupCaches];
|
|
|
|
|
2012-08-13 21:40:22 +02:00
|
|
|
rc = MAPISTORE_SUCCESS;
|
|
|
|
}
|
|
|
|
else
|
2012-08-15 03:02:08 +02:00
|
|
|
rc = [super moveCopyToFolder: targetFolder withNewName: newFolderName
|
|
|
|
isMove: isMove
|
2012-12-07 19:30:50 +01:00
|
|
|
isRecursive: isRecursive
|
|
|
|
inMemCtx: memCtx];
|
2012-08-13 21:40:22 +02:00
|
|
|
|
|
|
|
return rc;
|
|
|
|
}
|
|
|
|
|
2011-09-21 21:33:35 +02:00
|
|
|
- (MAPIStoreMessage *) createMessage
|
2011-02-24 21:32:27 +01:00
|
|
|
{
|
|
|
|
MAPIStoreMessage *newMessage;
|
2012-06-29 19:59:38 +02:00
|
|
|
SOGoMAPIDBMessage *fsObject;
|
2011-02-24 21:32:27 +01:00
|
|
|
NSString *newKey;
|
|
|
|
|
2015-08-03 15:16:55 +02:00
|
|
|
[[self userContext] activate];
|
|
|
|
|
2011-02-24 21:32:27 +01:00
|
|
|
newKey = [NSString stringWithFormat: @"%@.plist",
|
|
|
|
[SOGoObject globallyUniqueObjectId]];
|
2012-06-29 19:59:38 +02:00
|
|
|
fsObject = [SOGoMAPIDBMessage objectWithName: newKey
|
2011-12-01 23:42:30 +01:00
|
|
|
inContainer: sogoObject];
|
2014-05-13 23:54:02 +02:00
|
|
|
[fsObject setObjectType: MAPIMessageCacheObject];
|
2012-07-25 19:44:35 +02:00
|
|
|
[fsObject reloadIfNeeded];
|
2012-06-29 19:59:38 +02:00
|
|
|
newMessage = [MAPIStoreDBMessage mapiStoreObjectWithSOGoObject: fsObject
|
2011-02-24 21:32:27 +01:00
|
|
|
inContainer: self];
|
|
|
|
|
|
|
|
return newMessage;
|
|
|
|
}
|
|
|
|
|
2011-07-26 22:13:10 +02:00
|
|
|
- (NSArray *) messageKeysMatchingQualifier: (EOQualifier *) qualifier
|
|
|
|
andSortOrderings: (NSArray *) sortOrderings
|
2011-02-24 21:32:27 +01:00
|
|
|
{
|
2011-12-02 18:14:19 +01:00
|
|
|
NSArray *keys;
|
2012-01-29 20:55:21 +01:00
|
|
|
SOGoUser *ownerUser;
|
2011-12-02 18:14:19 +01:00
|
|
|
|
2012-01-29 20:55:21 +01:00
|
|
|
ownerUser = [[self userContext] sogoUser];
|
|
|
|
if ([[context activeUser] isEqual: ownerUser]
|
2011-12-02 18:14:19 +01:00
|
|
|
|| [self subscriberCanReadMessages])
|
2015-08-03 15:16:55 +02:00
|
|
|
{
|
|
|
|
[[self userContext] activate];
|
|
|
|
keys = [(SOGoCacheGCSFolder *) sogoObject childKeysOfType: MAPIMessageCacheObject
|
|
|
|
includeDeleted: NO
|
|
|
|
matchingQualifier: qualifier
|
|
|
|
andSortOrderings: sortOrderings];
|
|
|
|
}
|
2011-12-02 18:14:19 +01:00
|
|
|
else
|
|
|
|
keys = [NSArray array];
|
|
|
|
|
|
|
|
return keys;
|
2011-02-24 21:32:27 +01:00
|
|
|
}
|
|
|
|
|
2011-08-12 00:56:04 +02:00
|
|
|
- (NSArray *) folderKeysMatchingQualifier: (EOQualifier *) qualifier
|
|
|
|
andSortOrderings: (NSArray *) sortOrderings
|
|
|
|
{
|
2015-08-03 15:16:55 +02:00
|
|
|
[[self userContext] activate];
|
2014-05-13 23:54:02 +02:00
|
|
|
return [dbFolder childKeysOfType: MAPIFolderCacheObject
|
2012-06-29 19:59:38 +02:00
|
|
|
includeDeleted: NO
|
|
|
|
matchingQualifier: qualifier
|
|
|
|
andSortOrderings: sortOrderings];
|
2011-08-12 00:56:04 +02:00
|
|
|
}
|
|
|
|
|
2012-07-20 17:44:25 +02:00
|
|
|
/* TODO: now that we are DB-based, this method can easily be implemented
|
|
|
|
|
|
|
|
- (NSArray *) getDeletedKeysFromChangeNumber: (uint64_t) changeNum
|
|
|
|
andCN: (NSNumber **) cnNbrs
|
|
|
|
inTableType: (enum mapistore_table_type) tableType
|
|
|
|
{
|
|
|
|
}
|
|
|
|
*/
|
|
|
|
|
2011-06-07 02:17:46 +02:00
|
|
|
- (NSDate *) lastMessageModificationTime
|
|
|
|
{
|
|
|
|
NSUInteger count, max;
|
|
|
|
NSDate *date, *fileDate;
|
2012-06-29 19:59:38 +02:00
|
|
|
MAPIStoreDBMessage *msg;
|
2012-03-09 03:08:57 +01:00
|
|
|
NSArray *messageKeys;
|
2011-06-07 02:17:46 +02:00
|
|
|
|
2012-03-09 03:08:57 +01:00
|
|
|
messageKeys = [self messageKeys];
|
2011-06-07 02:17:46 +02:00
|
|
|
|
|
|
|
date = [NSCalendarDate date];
|
2013-03-13 20:04:11 +01:00
|
|
|
//[self logWithFormat: @"current date: %@", date];
|
2011-06-07 02:17:46 +02:00
|
|
|
|
|
|
|
max = [messageKeys count];
|
|
|
|
for (count = 0; count < max; count++)
|
|
|
|
{
|
2011-07-26 21:02:45 +02:00
|
|
|
msg = [self lookupMessage: [messageKeys objectAtIndex: count]];
|
2011-06-07 02:17:46 +02:00
|
|
|
fileDate = [msg lastModificationTime];
|
|
|
|
if ([date laterDate: fileDate] == fileDate)
|
|
|
|
{
|
2013-03-13 20:04:11 +01:00
|
|
|
//[self logWithFormat: @"current date: %@", date];
|
2015-08-03 15:16:55 +02:00
|
|
|
|
2011-06-07 02:17:46 +02:00
|
|
|
date = fileDate;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return date;
|
|
|
|
}
|
|
|
|
|
2011-11-18 16:26:03 +01:00
|
|
|
- (SOGoFolder *) aclFolder
|
|
|
|
{
|
2012-06-29 19:59:38 +02:00
|
|
|
return sogoObject;
|
2011-11-18 16:26:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (NSArray *) rolesForExchangeRights: (uint32_t) rights
|
|
|
|
{
|
|
|
|
NSMutableArray *roles;
|
|
|
|
|
|
|
|
roles = [NSMutableArray arrayWithCapacity: 9];
|
|
|
|
if (rights & RightsReadItems)
|
2011-12-02 00:02:45 +01:00
|
|
|
[roles addObject: MAPIStoreRightReadItems];
|
2011-11-18 16:26:03 +01:00
|
|
|
if (rights & RightsCreateItems)
|
2011-12-02 00:02:45 +01:00
|
|
|
[roles addObject: MAPIStoreRightCreateItems];
|
2011-11-18 16:26:03 +01:00
|
|
|
if (rights & RightsEditOwn)
|
2011-12-02 00:02:45 +01:00
|
|
|
[roles addObject: MAPIStoreRightEditOwn];
|
2011-11-18 16:26:03 +01:00
|
|
|
if (rights & RightsDeleteOwn)
|
2011-12-02 00:02:45 +01:00
|
|
|
[roles addObject: MAPIStoreRightDeleteOwn];
|
2011-11-18 16:26:03 +01:00
|
|
|
if (rights & RightsEditAll)
|
2011-12-02 00:02:45 +01:00
|
|
|
[roles addObject: MAPIStoreRightEditAll];
|
2011-11-18 16:26:03 +01:00
|
|
|
if (rights & RightsDeleteAll)
|
2011-12-02 00:02:45 +01:00
|
|
|
[roles addObject: MAPIStoreRightDeleteAll];
|
2011-11-18 16:26:03 +01:00
|
|
|
if (rights & RightsCreateSubfolders)
|
2011-12-02 00:02:45 +01:00
|
|
|
[roles addObject: MAPIStoreRightCreateSubfolders];
|
2011-11-18 16:26:03 +01:00
|
|
|
if (rights & RightsFolderOwner)
|
2011-12-02 00:02:45 +01:00
|
|
|
[roles addObject: MAPIStoreRightFolderOwner];
|
2011-11-18 16:26:03 +01:00
|
|
|
if (rights & RightsFolderContact)
|
2011-12-02 00:02:45 +01:00
|
|
|
[roles addObject: MAPIStoreRightFolderContact];
|
2011-11-18 16:26:03 +01:00
|
|
|
|
|
|
|
return roles;
|
|
|
|
}
|
|
|
|
|
|
|
|
- (uint32_t) exchangeRightsForRoles: (NSArray *) roles
|
|
|
|
{
|
|
|
|
uint32_t rights = 0;
|
|
|
|
|
2011-12-02 00:02:45 +01:00
|
|
|
if ([roles containsObject: MAPIStoreRightReadItems])
|
2011-11-18 16:26:03 +01:00
|
|
|
rights |= RightsReadItems;
|
2011-12-02 00:02:45 +01:00
|
|
|
if ([roles containsObject: MAPIStoreRightCreateItems])
|
2011-11-18 16:26:03 +01:00
|
|
|
rights |= RightsCreateItems;
|
2011-12-02 00:02:45 +01:00
|
|
|
if ([roles containsObject: MAPIStoreRightEditOwn])
|
2011-11-18 16:26:03 +01:00
|
|
|
rights |= RightsEditOwn;
|
2011-12-02 00:02:45 +01:00
|
|
|
if ([roles containsObject: MAPIStoreRightDeleteOwn])
|
2011-11-18 16:26:03 +01:00
|
|
|
rights |= RightsDeleteOwn;
|
2011-12-02 00:02:45 +01:00
|
|
|
if ([roles containsObject: MAPIStoreRightEditAll])
|
2015-12-30 15:22:08 +01:00
|
|
|
rights |= RightsEditAll | RightsEditOwn;
|
2011-12-02 00:02:45 +01:00
|
|
|
if ([roles containsObject: MAPIStoreRightDeleteAll])
|
2015-12-30 15:22:08 +01:00
|
|
|
rights |= RightsDeleteAll | RightsDeleteOwn;
|
2011-12-02 00:02:45 +01:00
|
|
|
if ([roles containsObject: MAPIStoreRightCreateSubfolders])
|
2011-11-18 16:26:03 +01:00
|
|
|
rights |= RightsCreateSubfolders;
|
2011-12-02 00:02:45 +01:00
|
|
|
if ([roles containsObject: MAPIStoreRightFolderOwner])
|
2011-11-18 16:26:03 +01:00
|
|
|
rights |= RightsFolderOwner;
|
2011-12-02 00:02:45 +01:00
|
|
|
if ([roles containsObject: MAPIStoreRightFolderContact])
|
2011-11-18 16:26:03 +01:00
|
|
|
rights |= RightsFolderContact;
|
|
|
|
if (rights != 0)
|
|
|
|
rights |= RoleNone; /* actually "folder visible" */
|
2015-08-03 15:16:55 +02:00
|
|
|
|
2011-11-18 16:26:03 +01:00
|
|
|
return rights;
|
|
|
|
}
|
|
|
|
|
2011-12-02 00:02:45 +01:00
|
|
|
- (BOOL) _testRoleForActiveUser: (const NSString *) role
|
2011-12-01 23:53:11 +01:00
|
|
|
{
|
|
|
|
SOGoUser *activeUser;
|
|
|
|
NSArray *roles;
|
|
|
|
|
|
|
|
activeUser = [[self context] activeUser];
|
|
|
|
|
|
|
|
roles = [[self aclFolder] aclsForUser: [activeUser login]];
|
|
|
|
|
|
|
|
return [roles containsObject: role];
|
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) subscriberCanCreateMessages
|
|
|
|
{
|
2011-12-02 00:02:45 +01:00
|
|
|
return [self _testRoleForActiveUser: MAPIStoreRightCreateItems];
|
2011-12-01 23:53:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) subscriberCanModifyMessages
|
|
|
|
{
|
2011-12-02 00:02:45 +01:00
|
|
|
return ([self _testRoleForActiveUser: MAPIStoreRightEditAll]
|
|
|
|
|| [self _testRoleForActiveUser: MAPIStoreRightEditOwn]);
|
2011-12-01 23:53:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) subscriberCanReadMessages
|
|
|
|
{
|
2012-11-09 20:50:56 +01:00
|
|
|
NSString *displayName;
|
|
|
|
|
|
|
|
/* when this folder is the "Freebusy Data" folder, we need to allow
|
|
|
|
subscribed to read an open contained messages in order to enable them to
|
|
|
|
find the "LocalFreebusy" message */
|
|
|
|
[sogoObject reloadIfNeeded];
|
2015-08-03 15:16:55 +02:00
|
|
|
|
2012-11-09 20:50:56 +01:00
|
|
|
displayName = [[sogoObject properties]
|
|
|
|
objectForKey: MAPIPropertyKey (PidTagDisplayName)];
|
|
|
|
|
|
|
|
return ([displayName isEqualToString: @"Freebusy Data"]
|
|
|
|
|| [self _testRoleForActiveUser: MAPIStoreRightReadItems]);
|
2011-12-01 23:53:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) subscriberCanDeleteMessages
|
|
|
|
{
|
2011-12-02 00:02:45 +01:00
|
|
|
return ([self _testRoleForActiveUser: MAPIStoreRightDeleteAll]
|
|
|
|
|| [self _testRoleForActiveUser: MAPIStoreRightDeleteOwn]);
|
2011-12-01 23:53:11 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
- (BOOL) subscriberCanCreateSubFolders
|
|
|
|
{
|
2011-12-02 00:02:45 +01:00
|
|
|
return [self _testRoleForActiveUser: MAPIStoreRightCreateSubfolders];
|
2011-12-01 23:53:11 +01:00
|
|
|
}
|
|
|
|
|
2012-01-26 20:56:24 +01:00
|
|
|
- (BOOL) supportsSubFolders
|
|
|
|
{
|
|
|
|
return YES;
|
|
|
|
}
|
|
|
|
|
2011-02-24 21:32:27 +01:00
|
|
|
@end
|