[Web] Allow to select aliases for BCC
This commit is contained in:
parent
1bad74101f
commit
735bcb2f55
@ -949,6 +949,9 @@ function user_get_alias_details($username) {
|
|||||||
if (!filter_var($username, FILTER_VALIDATE_EMAIL)) {
|
if (!filter_var($username, FILTER_VALIDATE_EMAIL)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (!hasMailboxObjectAccess($username, $_SESSION['mailcow_cc_role'], $username)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
$data['address'] = $username;
|
$data['address'] = $username;
|
||||||
$stmt = $pdo->prepare("SELECT `address` AS `shared_aliases`, `public_comment` FROM `alias`
|
$stmt = $pdo->prepare("SELECT `address` AS `shared_aliases`, `public_comment` FROM `alias`
|
||||||
WHERE `goto` REGEXP :username_goto
|
WHERE `goto` REGEXP :username_goto
|
||||||
|
@ -565,13 +565,13 @@ jQuery(function($){
|
|||||||
ft_bcc_table = FooTable.init('#bcc_table', {
|
ft_bcc_table = FooTable.init('#bcc_table', {
|
||||||
"columns": [
|
"columns": [
|
||||||
{"name":"chkbox","title":"","style":{"min-width":"60px","width":"60px"},"filterable": false,"sortable": false,"type":"html"},
|
{"name":"chkbox","title":"","style":{"min-width":"60px","width":"60px"},"filterable": false,"sortable": false,"type":"html"},
|
||||||
{"sorted": true,"name":"id","title":"ID","style":{"maxWidth":"60px","width":"60px","text-align":"center"}},
|
{"sorted": true,"name":"id","title":"ID","style":{"min-width":"60px","width":"60px","text-align":"center"}},
|
||||||
{"name":"type","title":lang.bcc_type},
|
{"name":"type","title":lang.bcc_type},
|
||||||
{"name":"local_dest","title":lang.bcc_local_dest},
|
{"name":"local_dest","title":lang.bcc_local_dest},
|
||||||
{"name":"bcc_dest","title":lang.bcc_destinations},
|
{"name":"bcc_dest","title":lang.bcc_destinations},
|
||||||
{"name":"domain","title":lang.domain,"breakpoints":"xs sm"},
|
{"name":"domain","title":lang.domain,"breakpoints":"xs sm"},
|
||||||
{"name":"active","filterable": false,"style":{"maxWidth":"80px","width":"80px"},"title":lang.active,"formatter": function(value){return 1==value?'<i class="bi bi-check-lg"></i>':0==value&&'<i class="bi bi-x-lg"></i>';}},
|
{"name":"active","filterable": false,"style":{"min-width":"80px","width":"80px"},"title":lang.active,"formatter": function(value){return 1==value?'<i class="bi bi-check-lg"></i>':0==value&&'<i class="bi bi-x-lg"></i>';}},
|
||||||
{"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","maxWidth":"180px","width":"180px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}
|
{"name":"action","filterable": false,"sortable": false,"style":{"text-align":"right","min-width":"180px","width":"180px"},"type":"html","title":lang.action,"breakpoints":"xs sm"}
|
||||||
],
|
],
|
||||||
"empty": lang.empty,
|
"empty": lang.empty,
|
||||||
"rows": $.ajax({
|
"rows": $.ajax({
|
||||||
|
@ -650,25 +650,38 @@ if (!isset($_SESSION['mailcow_cc_role'])) {
|
|||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="control-label col-sm-2" for="local_dest"><?=$lang['mailbox']['bcc_local_dest'];?></label>
|
<label class="control-label col-sm-2" for="local_dest"><?=$lang['mailbox']['bcc_local_dest'];?></label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<select data-live-search="true" name="local_dest" required>
|
<select data-live-search="true" data-size="20" name="local_dest" required>
|
||||||
<?php
|
<?php
|
||||||
$domains = mailbox('get', 'domains');
|
$domains = mailbox('get', 'domains');
|
||||||
$alias_domains = mailbox('get', 'alias_domains');
|
$alias_domains = mailbox('get', 'alias_domains');
|
||||||
if (!empty($domains)) {
|
if (!empty($domains)) {
|
||||||
|
echo "<optgroup label=\"Domains\">";
|
||||||
foreach ($domains as $domain) {
|
foreach ($domains as $domain) {
|
||||||
echo "<option>".htmlspecialchars($domain)."</option>";
|
echo "<option>".htmlspecialchars($domain)."</option>";
|
||||||
}
|
}
|
||||||
|
echo "</optgroup>";
|
||||||
}
|
}
|
||||||
if (!empty($alias_domains)) {
|
if (!empty($alias_domains)) {
|
||||||
|
echo "<optgroup label=\"Alias Domains\">";
|
||||||
foreach ($alias_domains as $alias_domain) {
|
foreach ($alias_domains as $alias_domain) {
|
||||||
echo "<option>".htmlspecialchars($alias_domain)."</option>";
|
echo "<option>".htmlspecialchars($alias_domain)."</option>";
|
||||||
}
|
}
|
||||||
|
echo "</optgroup>";
|
||||||
}
|
}
|
||||||
if (!empty($domains)) {
|
if (!empty($domains)) {
|
||||||
foreach ($domains as $domain) {
|
foreach ($domains as $domain) {
|
||||||
$mailboxes = mailbox('get', 'mailboxes', $domain);
|
$mailboxes = mailbox('get', 'mailboxes', $domain);
|
||||||
foreach ($mailboxes as $mailbox) {
|
foreach ($mailboxes as $mailbox) {
|
||||||
echo "<option>".htmlspecialchars($mailbox)."</option>";
|
echo "<optgroup label=\"" . htmlspecialchars($mailbox) . "\">";
|
||||||
|
echo "<option> " . htmlspecialchars($mailbox) . "</option>";
|
||||||
|
$user_alias_details = user_get_alias_details($mailbox);
|
||||||
|
foreach ($user_alias_details['direct_aliases'] as $k => $v) {
|
||||||
|
echo "<option>" . htmlspecialchars($k) . "</option>";
|
||||||
|
}
|
||||||
|
foreach ($user_alias_details['shared_aliases'] as $k => $v) {
|
||||||
|
echo "<option>" . htmlspecialchars($k) . "</option>";
|
||||||
|
}
|
||||||
|
echo "</optgroup>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user