Fix goto in sender acl query, show alias by alias domain in fixed addresses within sender acl

This commit is contained in:
andryyy 2017-03-04 23:16:08 +01:00
parent 047e73e5df
commit d1decbd31e

View File

@ -4877,12 +4877,23 @@ function mailbox_get_sender_acl_handles($mailbox) {
$data['fixed_sender_aliases'] = array(); $data['fixed_sender_aliases'] = array();
try { try {
$stmt = $pdo->prepare("SELECT `address` FROM `alias` WHERE `goto` = :goto AND `address` NOT LIKE '@%'"); // Fixed addresses
$stmt->execute(array(':goto' => $mailbox)); $stmt = $pdo->prepare("SELECT `address` FROM `alias` WHERE `goto` LIKE :goto AND `address` NOT LIKE '@%'");
$stmt->execute(array(':goto' => '%' . $mailbox . '%'));
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC); $rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
while ($row = array_shift($rows)) { while ($row = array_shift($rows)) {
$data['fixed_sender_aliases'][] = $row['address']; $data['fixed_sender_aliases'][] = $row['address'];
} }
$stmt = $pdo->prepare("SELECT CONCAT(`local_part`, '@', `alias_domain`.`alias_domain`) AS `alias_domain_alias` FROM `mailbox`, `alias_domain`
WHERE `alias_domain`.`target_domain` = `mailbox`.`domain`
AND `mailbox`.`username` = :username");
$stmt->execute(array(':username' => $mailbox));
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
while ($row = array_shift($rows)) {
if (!empty($row['alias_domain_alias'])) {
$data['fixed_sender_aliases'][] = $row['alias_domain_alias'];
}
}
// Return array $data['sender_acl_domains/addresses']['ro'] with read-only objects // Return array $data['sender_acl_domains/addresses']['ro'] with read-only objects
// Return array $data['sender_acl_domains/addresses']['rw'] with read-write objects (can be deleted) // Return array $data['sender_acl_domains/addresses']['rw'] with read-write objects (can be deleted)