]> source.dussan.org Git - nextcloud-server.git/commitdiff
Move getCapabilities over to Core
authorRoeland Jago Douma <roeland@famdouma.nl>
Tue, 9 Aug 2016 08:21:51 +0000 (10:21 +0200)
committerRoeland Jago Douma <roeland@famdouma.nl>
Tue, 9 Aug 2016 18:56:31 +0000 (20:56 +0200)
core/Application.php
core/Controller/OCSController.php
core/routes.php
lib/private/OCS/Cloud.php
ocs/routes.php

index a0deaff2b93d2a0b338ebcfd732c1b686063cb67..e8c924432d17327e76a61cf73c91924d76cf9096 100644 (file)
@@ -186,6 +186,9 @@ class Application extends App {
                $container->registerService('TwoFactorAuthManager', function(SimpleContainer $c) {
                        return $c->query('ServerContainer')->getTwoFactorAuthManager();
                });
+               $container->registerService('OC\CapabilitiesManager', function(SimpleContainer $c) {
+                       return $c->query('ServerContainer')->getCapabilitiesManager();
+               });
        }
 
 }
index 278a16186bf5a701d91aa3e0b543aa720e9fccdc..750ab37eb88d64103f3bcf29c643041ac04a66be 100644 (file)
@@ -1,5 +1,24 @@
 <?php
-
+/**
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
 namespace OC\Core\Controller;
 
 use OC\CapabilitiesManager;
@@ -26,6 +45,10 @@ class OCSController extends \OCP\AppFramework\OCSController {
                $this->capabilitiesManager = $capabilitiesManager;
        }
 
+       /**
+        * @NoAdminRequired
+        * @return DataResponse
+        */
        public function getCapabilities() {
                $result = [];
                list($major, $minor, $micro) = \OCP\Util::getVersion();
@@ -41,4 +64,4 @@ class OCSController extends \OCP\AppFramework\OCSController {
 
                return new DataResponse(['data' => $result]);
        }
-}
\ No newline at end of file
+}
index 98454946d45c5c13256e0f3a1d6a58461c41a01f..92ce4440ecfde9567f9911e9b3cd1668f39b59fd 100644 (file)
@@ -53,6 +53,9 @@ $application->registerRoutes($this, [
                ['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'],
                ['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'],
        ],
+       'ocs' => [
+               ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'],
+       ],
 ]);
 
 // Post installation check
index 84fcfe6e51250e3bf8fc328a67abe7d1b993623f..3a00fa3756ef8622d9e7bbc70968effb6d47d957 100644 (file)
@@ -27,22 +27,6 @@ namespace OC\OCS;
 
 class Cloud {
 
-       public static function getCapabilities() {
-               $result = array();
-               list($major, $minor, $micro) = \OCP\Util::getVersion();
-               $result['version'] = array(
-                       'major' => $major,
-                       'minor' => $minor,
-                       'micro' => $micro,
-                       'string' => \OC_Util::getVersionString(),
-                       'edition' => \OC_Util::getEditionString(),
-                       );
-                       
-               $result['capabilities'] = \OC::$server->getCapabilitiesManager()->getCapabilities();
-
-               return new Result($result);
-       }
-       
        public static function getCurrentUser() {
                $userObject = \OC::$server->getUserManager()->get(\OC_User::getUser());
                $data  = array(
index 0606fe3e3096f806dc728e23ad5d3b54ad8cb771..bb24c79eba7cf317c8452930fedb65540a0ad288 100644 (file)
@@ -84,13 +84,6 @@ API::register(
        API::USER_AUTH
        );
 // cloud
-API::register(
-       'get',
-       '/cloud/capabilities',
-       array('OC_OCS_Cloud', 'getCapabilities'),
-       'core',
-       API::USER_AUTH
-       );
 API::register(
        'get',
        '/cloud/user',