Improve validation of mail account delegators
This commit is contained in:
parent
65a653ac0c
commit
b44bf86164
1
NEWS
1
NEWS
|
@ -16,6 +16,7 @@ Bug fixes
|
||||||
- [web] only show the organizer field of an IMIP REPLY if one is defined
|
- [web] only show the organizer field of an IMIP REPLY if one is defined
|
||||||
- [web] fixed saving the note of a card (#3849)
|
- [web] fixed saving the note of a card (#3849)
|
||||||
- [web] fixed support for recurrent tasks
|
- [web] fixed support for recurrent tasks
|
||||||
|
- [web] improved validation of mail account delegators
|
||||||
- [eas] improve handling of email folders without a parent
|
- [eas] improve handling of email folders without a parent
|
||||||
- [eas] never send IMIP reply when the "initiator" is Outlook 2013/2016
|
- [eas] never send IMIP reply when the "initiator" is Outlook 2013/2016
|
||||||
- [core] only consider SMTP addresses for AD's proxyAddresses (#3842)
|
- [core] only consider SMTP addresses for AD's proxyAddresses (#3842)
|
||||||
|
|
|
@ -1134,11 +1134,9 @@ static NSString *inboxFolderName = @"INBOX";
|
||||||
{
|
{
|
||||||
currentDelegate = [oldDelegates objectAtIndex: count];
|
currentDelegate = [oldDelegates objectAtIndex: count];
|
||||||
delegateUser = [SOGoUser userWithLogin: currentDelegate];
|
delegateUser = [SOGoUser userWithLogin: currentDelegate];
|
||||||
|
[delegates removeObject: currentDelegate];
|
||||||
if (delegateUser)
|
if (delegateUser)
|
||||||
{
|
[delegateUser removeMailDelegator: owner];
|
||||||
[delegates removeObject: currentDelegate];
|
|
||||||
[delegateUser removeMailDelegator: owner];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[self _setDelegates: delegates];
|
[self _setDelegates: delegates];
|
||||||
|
|
|
@ -634,8 +634,9 @@
|
||||||
NSUInteger index;
|
NSUInteger index;
|
||||||
|
|
||||||
[self userDefaults];
|
[self userDefaults];
|
||||||
|
[self userSettings];
|
||||||
|
|
||||||
mailSettings = [[self userSettings] objectForKey: @"Mail"];
|
mailSettings = [_settings objectForKey: @"Mail"];
|
||||||
mailAccount = [NSMutableDictionary new];
|
mailAccount = [NSMutableDictionary new];
|
||||||
|
|
||||||
// 1. login
|
// 1. login
|
||||||
|
@ -800,18 +801,43 @@
|
||||||
delegators = [mailSettings objectForKey: @"DelegateFrom"];
|
delegators = [mailSettings objectForKey: @"DelegateFrom"];
|
||||||
if (delegators)
|
if (delegators)
|
||||||
{
|
{
|
||||||
NSDictionary *delegatorAccount;
|
BOOL dirty;
|
||||||
SOGoUser *delegator;
|
NSDictionary *delegatorAccount, *delegatorSettings;
|
||||||
|
NSMutableArray *validDelegators;
|
||||||
|
NSString *delegatorLogin;
|
||||||
|
SOGoUser *delegatorUser;
|
||||||
|
|
||||||
|
dirty = NO;
|
||||||
|
validDelegators = [NSMutableArray array];
|
||||||
max = [delegators count];
|
max = [delegators count];
|
||||||
for (count = 0; count < max; count++)
|
for (count = 0; count < max; count++)
|
||||||
{
|
{
|
||||||
delegator = [SOGoUser userWithLogin: [delegators objectAtIndex: count]];
|
// 1. Verify if delegator is valid
|
||||||
if (delegator)
|
delegatorLogin = [delegators objectAtIndex: count];
|
||||||
|
delegatorUser = [SOGoUser userWithLogin: delegatorLogin];
|
||||||
|
if (delegatorUser)
|
||||||
{
|
{
|
||||||
delegatorAccount = [[delegator mailAccountsWithDelegatedIdentities: NO] objectAtIndex: 0];
|
// 2. Verify if delegator still delegates to user
|
||||||
[identities addObjectsFromArray: [delegatorAccount objectForKey: @"identities"]];
|
delegatorSettings = [[delegatorUser userSettings] objectForKey: @"Mail"];
|
||||||
|
delegates = [delegatorSettings objectForKey: @"DelegateTo"];
|
||||||
|
if ([delegates containsObject: [self login]])
|
||||||
|
{
|
||||||
|
[validDelegators addObject: delegatorLogin];
|
||||||
|
delegatorAccount = [[delegatorUser mailAccountsWithDelegatedIdentities: NO] objectAtIndex: 0];
|
||||||
|
[identities addObjectsFromArray: [delegatorAccount objectForKey: @"identities"]];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
dirty = YES;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
dirty = YES;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (dirty)
|
||||||
|
{
|
||||||
|
[mailSettings setObject: validDelegators
|
||||||
|
forKey: @"DelegateFrom"];
|
||||||
|
[_settings synchronize];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue