From 91c07c9eae0a222dd5f6a708902185a65db2a846 Mon Sep 17 00:00:00 2001 From: Christian Boltz Date: Sun, 25 Mar 2018 15:03:29 +0200 Subject: [PATCH] VacationHandler: re-enable and fix code in validate_new_id() Note that vacation.php doesn't use this function yet, so it's not surprising that users didn't notice the broken code. --- model/VacationHandler.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/model/VacationHandler.php b/model/VacationHandler.php index 677721f9..1bfb91ff 100644 --- a/model/VacationHandler.php +++ b/model/VacationHandler.php @@ -87,8 +87,19 @@ class VacationHandler extends PFAHandler { protected function validate_new_id() { # vacation can only be enabled if a mailbox with this name exists - //$handler = new MailboxHandler(); - //return $handler->init(); // was: ...init($address); but $address is not defined. + if ($this->is_admin) { + $handler = new MailboxHandler(0, $this->admin_username); + if ($handler->init($this->id)) { + return true; + } + } else { + if ($this->id == $this->username) { + return true; + } + } + + # still here? This means the mailbox doesn't exist or the admin/user doesn't have permissions to view it + $this->errormsg[] = Config::Lang('invalid_parameter'); return false; }