]> source.dussan.org Git - nextcloud-server.git/commitdiff
Consolidate user mounting check code
authorRobin McCorkell <rmccorkell@owncloud.com>
Thu, 14 Jan 2016 22:13:28 +0000 (22:13 +0000)
committerRobin McCorkell <rmccorkell@owncloud.com>
Thu, 14 Jan 2016 22:13:28 +0000 (22:13 +0000)
apps/files_external/appinfo/app.php
apps/files_external/appinfo/application.php

index 9a2ec7286ca026e09541dba82ab279d6227e4c3f..c8d90f02f297f5151a511cdf375da5a8dd300cb7 100644 (file)
@@ -45,12 +45,9 @@ require_once __DIR__ . '/../3rdparty/autoload.php';
 \OC_Mount_Config::$app = new \OCA\Files_external\Appinfo\Application();
 $appContainer = \OC_Mount_Config::$app->getContainer();
 
-$l = \OC::$server->getL10N('files_external');
+\OC_Mount_Config::$app->registerSettings();
 
-OCP\App::registerAdmin('files_external', 'settings');
-if (OCP\Config::getAppValue('files_external', 'allow_user_mounting', 'yes') == 'yes') {
-       OCP\App::registerPersonal('files_external', 'personal');
-}
+$l = \OC::$server->getL10N('files_external');
 
 \OCA\Files\App::getNavigationManager()->add([
        "id" => 'extstoragemounts',
index b750734bf34c652fecb5371060b56bb08d455db2..0c8b90935d38c8576f10600666401dc112c5b8ab 100644 (file)
@@ -45,6 +45,19 @@ class Application extends App {
                );
        }
 
+       /**
+        * Register settings templates
+        */
+       public function registerSettings() {
+               $container = $this->getContainer();
+               $backendService = $container->query('OCA\\Files_External\\Service\\BackendService');
+
+               \OCP\App::registerAdmin('files_external', 'settings');
+               if ($backendService->isUserMountingAllowed()) {
+                       \OCP\App::registerPersonal('files_external', 'personal');
+               }
+       }
+
        /**
         * Load storage backends provided by this app
         */