From 889d8670dca330a748af3cb0e24bf2130f0513ba Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Fri, 24 Jan 2014 14:11:24 +0100 Subject: [PATCH] Support kolab_files_disabled and kolab_files_enabled config --- plugins/kolab_files/kolab_files.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/plugins/kolab_files/kolab_files.php b/plugins/kolab_files/kolab_files.php index 16f156ee..ad9f2846 100644 --- a/plugins/kolab_files/kolab_files.php +++ b/plugins/kolab_files/kolab_files.php @@ -52,7 +52,8 @@ class kolab_files extends rcube_plugin // we use libkolab::http_request() from libkolab with its configuration $this->require_plugin('libkolab'); - $this->ui(); + // Load UI from startup hook + $this->add_hook('startup', array($this, 'startup')); } /** @@ -61,6 +62,11 @@ class kolab_files extends rcube_plugin private function engine() { if ($this->engine === null) { + // the files module can be enabled/disabled by the kolab_auth plugin + if ($this->rc->config->get('kolab_files_disabled') || !$this->rc->config->get('kolab_files_enabled', true)) { + return $this->engine = false; + } + $this->load_config(); $url = $this->rc->config->get('kolab_files_url'); @@ -77,6 +83,16 @@ class kolab_files extends rcube_plugin return $this->engine; } + /** + * Startup hook handler, initializes/enables Files UI + */ + public function startup($args) + { + // call this from startup to give a chance to set + // kolab_files_enabled/disabled in kolab_auth plugin + $this->ui(); + } + /** * Adds elements of files API user interface */