(feat) now possible to specify which domains you can forward your mails to

pull/259/head
Ludovic Marcotte 2019-08-15 12:48:53 -04:00
parent f7f9cb29e0
commit 04f91b8948
8 changed files with 39 additions and 3 deletions

View File

@ -2118,6 +2118,15 @@ automatically forwarding mails. When set to `0` (default), no constraint
is enforced. When set to `1`, only internal domains can be used. When
set to `2`, only external domains can be used.
|D |SOGoForwardConstraintsDomains
|Parameter used to set which domains are allowed as external domains
when SOGoForwardConstraints is set to `2`. For example, setting:
SOGoForwardConstraintsDomains = ("gmail.com", "googlemail.com");
will allow users to forward emails to only `gmail.com` and `googlemail.com` domains.
When empty or undefined, no constraints are imposed.
|D |SOGoSieveScriptsEnabled
|Parameter used to activate the edition from the preferences windows of
server-side mail filters. Requires Sieve script support on the IMAP

1
NEWS
View File

@ -3,6 +3,7 @@
New features
- [core] Debian 10 (Buster) support for x86_64 (#4775)
- [core] now possible to specify which domains you can forward your mails to
Enhancements
- [web] avoid saving an empty calendar name

View File

@ -1,6 +1,6 @@
/* SOGoDomainDefaults.h - this file is part of SOGo
*
* Copyright (C) 2009-2016 Inverse inc.
* Copyright (C) 2009-2019 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
@ -51,6 +51,7 @@
- (BOOL) sieveScriptsEnabled;
- (BOOL) forwardEnabled;
- (int) forwardConstraints;
- (NSArray *) forwardConstraintsDomains;
- (BOOL) vacationEnabled;
- (NSString *) vacationDefaultSubject;
- (NSString *) vacationHeaderTemplateFile;

View File

@ -1,6 +1,6 @@
/* SOGoDomainDefaults.m - this file is part of SOGo
*
* Copyright (C) 2009-2016 Inverse inc.
* Copyright (C) 2009-2019 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
@ -215,6 +215,11 @@
return (v > 2 ? 0 : v);
}
- (NSArray *) forwardConstraintsDomains
{
return [self stringArrayForKey: @"SOGoForwardConstraintsDomains"];
}
- (BOOL) vacationEnabled
{
return [self boolForKey: @"SOGoVacationEnabled"];

View File

@ -63,6 +63,7 @@
= "Please specify an address to which you want to forward your messages.";
"You are not allowed to forward your messages to an external email address." = "You are not allowed to forward your messages to an external email address.";
"You are not allowed to forward your messages to an internal email address." = "You are not allowed to forward your messages to an internal email address.";
"You are not allowed to forward your messages to this domain:" = "You are not allowed to forward your messages to this domain:";
/* d & t */
"Current Time Zone" = "Current Time Zone";

View File

@ -1,6 +1,6 @@
/* UIxPreferences.m - this file is part of SOGo
*
* Copyright (C) 2007-2018 Inverse inc.
* Copyright (C) 2007-2019 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
@ -1495,6 +1495,18 @@ static NSArray *reminderValues = nil;
return [NSString stringWithFormat: @"%d", [dd forwardConstraints]];
}
- (NSString *) forwardConstraintsDomains
{
NSMutableArray *domains;
SOGoDomainDefaults *dd;
dd = [[context activeUser] domainDefaults];
domains = [NSMutableArray array];
[domains addObjectsFromArray: [dd forwardConstraintsDomains]];
return [domains jsonRepresentation];
}
//
// Used by templates
//

View File

@ -21,6 +21,7 @@
var defaultEmailAddresses = '<var:string value="defaultEmailAddresses" const:escapeHTML="NO"/>';
var defaultCalendarCategories = <var:string value="defaultCalendarCategoriesColors" const:escapeHTML="NO"/>;
var forwardConstraints = <var:string value="forwardConstraints" const:escapeHTML="NO"/>;
var forwardConstraintsDomains = <var:string value="forwardConstraintsDomains" const:escapeHTML="NO"/>;
var sieveCapabilities = <var:string value="sieveCapabilities" const:escapeHTML="NO"/>;
</script>

View File

@ -347,6 +347,12 @@
Dialog.alert(l('Error'), l("You are not allowed to forward your messages to an internal email address."));
sendForm = false;
}
else if ($window.forwardConstraints == 2 &&
$window.forwardConstraintsDomains.length > 0 &&
$window.forwardConstraintsDomains.indexOf(domain) < 0) {
Dialog.alert(l('Error'), l("You are not allowed to forward your messages to this domain:") + " " + domain);
sendForm = false;
}
}
}