(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 is enforced. When set to `1`, only internal domains can be used. When
set to `2`, only external domains can be used. 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 |D |SOGoSieveScriptsEnabled
|Parameter used to activate the edition from the preferences windows of |Parameter used to activate the edition from the preferences windows of
server-side mail filters. Requires Sieve script support on the IMAP server-side mail filters. Requires Sieve script support on the IMAP

1
NEWS
View File

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

View File

@ -1,6 +1,6 @@
/* SOGoDomainDefaults.h - this file is part of SOGo /* 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 * 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 * it under the terms of the GNU General Public License as published by
@ -51,6 +51,7 @@
- (BOOL) sieveScriptsEnabled; - (BOOL) sieveScriptsEnabled;
- (BOOL) forwardEnabled; - (BOOL) forwardEnabled;
- (int) forwardConstraints; - (int) forwardConstraints;
- (NSArray *) forwardConstraintsDomains;
- (BOOL) vacationEnabled; - (BOOL) vacationEnabled;
- (NSString *) vacationDefaultSubject; - (NSString *) vacationDefaultSubject;
- (NSString *) vacationHeaderTemplateFile; - (NSString *) vacationHeaderTemplateFile;

View File

@ -1,6 +1,6 @@
/* SOGoDomainDefaults.m - this file is part of SOGo /* 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 * 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 * it under the terms of the GNU General Public License as published by
@ -215,6 +215,11 @@
return (v > 2 ? 0 : v); return (v > 2 ? 0 : v);
} }
- (NSArray *) forwardConstraintsDomains
{
return [self stringArrayForKey: @"SOGoForwardConstraintsDomains"];
}
- (BOOL) vacationEnabled - (BOOL) vacationEnabled
{ {
return [self boolForKey: @"SOGoVacationEnabled"]; return [self boolForKey: @"SOGoVacationEnabled"];

View File

@ -63,6 +63,7 @@
= "Please specify an address to which you want to forward your messages."; = "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 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 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 */ /* d & t */
"Current Time Zone" = "Current Time Zone"; "Current Time Zone" = "Current Time Zone";

View File

@ -1,6 +1,6 @@
/* UIxPreferences.m - this file is part of SOGo /* 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 * 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 * 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]]; 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 // Used by templates
// //

View File

@ -21,6 +21,7 @@
var defaultEmailAddresses = '<var:string value="defaultEmailAddresses" const:escapeHTML="NO"/>'; var defaultEmailAddresses = '<var:string value="defaultEmailAddresses" const:escapeHTML="NO"/>';
var defaultCalendarCategories = <var:string value="defaultCalendarCategoriesColors" const:escapeHTML="NO"/>; var defaultCalendarCategories = <var:string value="defaultCalendarCategoriesColors" const:escapeHTML="NO"/>;
var forwardConstraints = <var:string value="forwardConstraints" 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"/>; var sieveCapabilities = <var:string value="sieveCapabilities" const:escapeHTML="NO"/>;
</script> </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.")); Dialog.alert(l('Error'), l("You are not allowed to forward your messages to an internal email address."));
sendForm = false; 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;
}
} }
} }