getIdentity() instanceof \Model_Admin) { throw new \FOSSBilling\InformationException('Administrator authentication required'); } $this->checkPermissions('mailgateway', 'manage_settings'); return [ 'settings' => $this->getService()->getSettings(), 'dependencies' => $this->getService()->getDependencyStatus(), 'notifications' => $this->getService()->getNotificationStatus(), 'mailboxes' => $this->getService()->getMailboxes(), 'helpdesks' => $this->getDi()['mod_service']('support')->getHelpdeskRepository()->getPairs(), ]; } public function settings_save(array $data): bool { if (!$this->getIdentity() instanceof \Model_Admin) { throw new \FOSSBilling\InformationException('Administrator authentication required'); } $this->checkPermissions('mailgateway', 'manage_settings'); return $this->getService()->saveSettings($data); } public function test_connection(array $data): array { if (!$this->getIdentity() instanceof \Model_Admin) { throw new \FOSSBilling\InformationException('Administrator authentication required'); } $this->checkPermissions('mailgateway', 'manage_settings'); return $this->getService()->testConnection($data); } public function install_dependencies(array $data): array { if (!$this->getIdentity() instanceof \Model_Admin) { throw new \FOSSBilling\InformationException('Administrator authentication required'); } $this->checkPermissions('mailgateway', 'manage_settings'); $force = $data['force'] ?? false; if (!in_array($force, [true, false, 0, 1, '0', '1'], true)) { throw new \FOSSBilling\InformationException('Invalid dependency installation option'); } return $this->getService()->installDependencies(in_array($force, [true, 1, '1'], true)); } public function setup(array $data): bool { if (!$this->getIdentity() instanceof \Model_Admin) { throw new \FOSSBilling\InformationException('Administrator authentication required'); } $this->checkPermissions('mailgateway', 'manage_settings'); return $this->getService()->setup(); } public function notifications_setup(array $data): array { if (!$this->getIdentity() instanceof \Model_Admin) { throw new \FOSSBilling\InformationException('Administrator authentication required'); } $this->checkPermissions('mailgateway', 'manage_settings'); return $this->getService()->configureNotifications(); } public function mailbox_delete(array $data): bool { if (!$this->getIdentity() instanceof \Model_Admin) { throw new \FOSSBilling\InformationException('Administrator authentication required'); } $this->checkPermissions('mailgateway', 'manage_settings'); return $this->getService()->deleteMailbox($data); } }