From 1765e17207956ec24479bbdf6dd5336200e64019 Mon Sep 17 00:00:00 2001 From: Sergey Linnik Date: Mon, 27 Jan 2020 14:12:28 +0300 Subject: [PATCH] direct editing for selected groups (Fixed #228) --- appinfo/application.php | 3 +-- lib/directeditor.php | 14 +++++++++++++- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/appinfo/application.php b/appinfo/application.php index 8e7375e1..af63b6ae 100644 --- a/appinfo/application.php +++ b/appinfo/application.php @@ -133,8 +133,7 @@ function() { $eventDispatcher->addListener(RegisterDirectEditorEvent::class, function (RegisterDirectEditorEvent $event) use ($container) { if (!empty($this->appConfig->GetDocumentServerUrl()) - && $this->appConfig->SettingsAreSuccessful() - && $this->appConfig->isUserAllowedToUse()) { + && $this->appConfig->SettingsAreSuccessful()) { $editor = $container->query("DirectEditor"); $event->register($editor); } diff --git a/lib/directeditor.php b/lib/directeditor.php index 601e71aa..11b99c16 100644 --- a/lib/directeditor.php +++ b/lib/directeditor.php @@ -139,6 +139,10 @@ public function getName(): string { */ public function getMimetypes(): array { $mimes = array(); + if (!$this->config->isUserAllowedToUse()) { + return $mimes; + } + $formats = $this->config->FormatsSetting(); foreach ($formats as $format => $setting) { if (array_key_exists("edit", $setting) && $setting["edit"] @@ -157,6 +161,10 @@ public function getMimetypes(): array { */ public function getMimetypesOptional(): array { $mimes = array(); + if (!$this->config->isUserAllowedToUse()) { + return $mimes; + } + $formats = $this->config->FormatsSetting(); foreach ($formats as $format => $setting) { if (array_key_exists("edit", $setting) && $setting["edit"] @@ -174,6 +182,10 @@ public function getMimetypesOptional(): array { * @return array of ACreateFromTemplate|ACreateEmpty */ public function getCreators(): array { + if (!$this->config->isUserAllowedToUse()) { + return array(); + } + return [ new FileCreator($this->appName, $this->trans, $this->logger, "docx"), new FileCreator($this->appName, $this->trans, $this->logger, "xlsx"), @@ -194,7 +206,7 @@ public function isSecure(): bool { * Return a template response for displaying the editor * * open can only be called once when the client requests the editor with a one-time-use token - * For handling editing and later requests, editors need to impelement their own token handling + * For handling editing and later requests, editors need to implement their own token handling * and take care of invalidation * * @param IToken $token - one time token