(feat) added mailbox delegation support

This commit is contained in:
Ludovic Marcotte
2015-07-03 20:40:06 -04:00
parent 9225f2b908
commit 05d59df68b
6 changed files with 261 additions and 98 deletions
+62 -64
View File
@@ -1,8 +1,6 @@
/* UIxMailUserDelegationEditor.m - this file is part of SOGo
*
* Copyright (C) 2010 Inverse inc.
*
* Author: Wolfgang Sourdeau <wsourdeau@inverse.ca>
* Copyright (C) 2010-2015 Inverse inc.
*
* 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
@@ -29,84 +27,84 @@
#import <SOGoUI/UIxComponent.h>
@interface UIxMailUserDelegationEditor : UIxComponent
{
NSArray *delegates;
NSString *currentDelegate;
}
// {
// NSArray *delegates;
// NSString *currentDelegate;
// }
- (NSArray *) delegates;
- (void) setCurrentDelegate: (NSString *) newCurrentDelegate;
- (NSString *) currentDelegate;
// - (NSArray *) delegates;
// - (void) setCurrentDelegate: (NSString *) newCurrentDelegate;
// - (NSString *) currentDelegate;
@end
@implementation UIxMailUserDelegationEditor
- (id) init
{
if ((self = [super init]))
{
delegates = nil;
currentDelegate = nil;
}
// - (id) init
// {
// if ((self = [super init]))
// {
// delegates = nil;
// currentDelegate = nil;
// }
return self;
}
// return self;
// }
- (void) dealloc
{
[delegates release];
[currentDelegate release];
[super dealloc];
}
// - (void) dealloc
// {
// [delegates release];
// [currentDelegate release];
// [super dealloc];
// }
- (NSArray *) delegates
{
if (!delegates)
{
delegates = [[self clientObject] delegates];
[delegates retain];
}
// - (NSArray *) delegates
// {
// if (!delegates)
// {
// delegates = [[self clientObject] delegates];
// [delegates retain];
// }
return delegates;
}
// return delegates;
// }
- (void) setCurrentDelegate: (NSString *) newCurrentDelegate
{
ASSIGN (currentDelegate, newCurrentDelegate);
}
// - (void) setCurrentDelegate: (NSString *) newCurrentDelegate
// {
// ASSIGN (currentDelegate, newCurrentDelegate);
// }
- (NSString *) currentDelegate
{
return currentDelegate;
}
// - (NSString *) currentDelegate
// {
// return currentDelegate;
// }
- (NSString *) currentDelegateDisplayName
{
SOGoUserManager *um;
NSString *s;
// - (NSString *) currentDelegateDisplayName
// {
// SOGoUserManager *um;
// NSString *s;
um = [SOGoUserManager sharedUserManager];
s = ([currentDelegate hasPrefix: @"@"]
? [currentDelegate substringFromIndex: 1]
: currentDelegate);
// um = [SOGoUserManager sharedUserManager];
// s = ([currentDelegate hasPrefix: @"@"]
// ? [currentDelegate substringFromIndex: 1]
// : currentDelegate);
return [um getFullEmailForUID: s];
}
// return [um getFullEmailForUID: s];
// }
- (id) defaultAction
{
id response;
SOGoMailAccount *co;
// - (id) defaultAction
// {
// id response;
// SOGoMailAccount *co;
co = [self clientObject];
if ([[co nameInContainer] isEqualToString: @"0"])
response = self;
else
response = [self responseWithStatus: 403
andString: @"The list of account delegates cannot be modified on secondary accounts."];
// co = [self clientObject];
// if ([[co nameInContainer] isEqualToString: @"0"])
// response = self;
// else
// response = [self responseWithStatus: 403
// andString: @"The list of account delegates cannot be modified on secondary accounts."];
return response;
}
// return response;
// }
@end