mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-05-10 22:15:26 +00:00
Monotone-Parent: 19b842fa105a28640ea4883c6641a51413844f17
Monotone-Revision: 5b9fba133560acdca3843326561c729dd28fc4cc Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2011-08-02T20:43:33 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -0,0 +1,129 @@
|
||||
/* MAPIStorePermissionsTable.m - this file is part of SOGo
|
||||
*
|
||||
* Copyright (C) 2011 Inverse inc
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation; either version 3, or (at your option)
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import <Foundation/NSArray.h>
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
#import "MAPIStoreObject.h"
|
||||
#import "MAPIStoreTypes.h"
|
||||
#import "NSData+MAPIStore.h"
|
||||
#import "NSString+MAPIStore.h"
|
||||
|
||||
#import "MAPIStorePermissionsTable.h"
|
||||
|
||||
#include <mapistore/mapistore_errors.h>
|
||||
|
||||
@interface MAPIStorePermissionEntry : MAPIStoreObject
|
||||
{
|
||||
NSString *userId;
|
||||
}
|
||||
|
||||
+ (id) entryWithUserId: (NSString *) newUserId;
|
||||
- (id) initWithUserId: (NSString *) newUserId;
|
||||
|
||||
@end
|
||||
|
||||
@implementation MAPIStorePermissionEntry
|
||||
|
||||
+ (id) entryWithUserId: (NSString *) newUserId
|
||||
{
|
||||
MAPIStorePermissionEntry *newEntry;
|
||||
|
||||
newEntry = [[self alloc] initWithUserId: newUserId];
|
||||
[newEntry autorelease];
|
||||
|
||||
return newEntry;
|
||||
}
|
||||
|
||||
- (id) initWithUserId: (NSString *) newUserId
|
||||
{
|
||||
if ((self = [self init]))
|
||||
{
|
||||
ASSIGN (userId, newUserId);
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[userId release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (int) getPrMemberId: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
uint64_t value = 0;
|
||||
|
||||
if ([userId isEqualToString: @"anonymous"])
|
||||
value = 0xffffffffffffffff;
|
||||
|
||||
*data = MAPILongLongValue (memCtx, value);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPrEntryid: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = [[NSData data] asBinaryInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPrMemberName: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = [userId asUnicodeInMemCtx: memCtx];
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
- (int) getPrMemberRights: (void **) data
|
||||
inMemCtx: (TALLOC_CTX *) memCtx
|
||||
{
|
||||
*data = MAPILongValue (memCtx, 0);
|
||||
|
||||
return MAPISTORE_SUCCESS;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@implementation MAPIStorePermissionsTable
|
||||
|
||||
- (NSArray *) childKeys
|
||||
{
|
||||
return [NSArray arrayWithObjects: @"default", @"anonymous", nil];
|
||||
}
|
||||
|
||||
- (NSArray *) restrictedChildKeys
|
||||
{
|
||||
return [self childKeys];
|
||||
}
|
||||
|
||||
- (id) lookupChild: (NSString *) childKey
|
||||
{
|
||||
return [MAPIStorePermissionEntry entryWithUserId: childKey];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user