diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2015-03-21 20:12:55 +0100 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2015-08-10 10:45:16 +0200 |
commit | e84cffc063d508f8984909ba3e744eff970ecb88 (patch) | |
tree | 07bc4621077f256e3cb28748edab533791201a08 /apps/files_trashbin | |
parent | 7e6a2b71fd80fedabc64d10bee5ba0edc0b19cf0 (diff) | |
download | nextcloud-server-e84cffc063d508f8984909ba3e744eff970ecb88.tar.gz nextcloud-server-e84cffc063d508f8984909ba3e744eff970ecb88.zip |
Moved core apps to the capabilities manager
* Files
* Files_Sharing
* Files_Trashbin
* Files_Versions
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r-- | apps/files_trashbin/appinfo/application.php | 40 | ||||
-rw-r--r-- | apps/files_trashbin/appinfo/routes.php | 11 | ||||
-rw-r--r-- | apps/files_trashbin/lib/capabilities.php | 22 |
3 files changed, 58 insertions, 15 deletions
diff --git a/apps/files_trashbin/appinfo/application.php b/apps/files_trashbin/appinfo/application.php new file mode 100644 index 00000000000..851de142e5c --- /dev/null +++ b/apps/files_trashbin/appinfo/application.php @@ -0,0 +1,40 @@ +<?php +/** + * @author Roeland Jago Douma <roeland@famdouma.nl> + * + * @copyright Copyright (c) 2015, ownCloud, Inc. + * @license AGPL-3.0 + * + * This code is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * 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, version 3, + * along with this program. If not, see <http://www.gnu.org/licenses/> + * + */ + +namespace OCA\Files_Trashbin\AppInfo; + +use OCP\AppFramework\App; +use OCA\Files_Trashbin\Capabilities; + +class Application extends App { + public function __construct(array $urlParams = array()) { + parent::__construct('files_trashbin', $urlParams); + + $container = $this->getContainer(); + + /* + * Register capabilities + */ + $server->getCapabilitiesManager()->registerCapability(function() { + return new Capabilities(); + }); + } +} diff --git a/apps/files_trashbin/appinfo/routes.php b/apps/files_trashbin/appinfo/routes.php index 99a03d6b969..cf3d7b77ec2 100644 --- a/apps/files_trashbin/appinfo/routes.php +++ b/apps/files_trashbin/appinfo/routes.php @@ -1,9 +1,8 @@ <?php /** * @author Georg Ehrke <georg@owncloud.com> - * @author Joas Schilling <nickvergessen@owncloud.com> * @author Lukas Reschke <lukas@owncloud.com> - * @author Morris Jobke <hey@morrisjobke.de> + * @author Roeland Jago Douma <roeland@famdouma.nl> * @author Vincent Petry <pvince81@owncloud.com> * * @copyright Copyright (c) 2015, ownCloud, Inc. @@ -22,6 +21,11 @@ * along with this program. If not, see <http://www.gnu.org/licenses/> * */ + +namespace OCA\Files_Trashbin\AppInfo; + +$application = new Application(); + $this->create('core_ajax_trashbin_preview', 'ajax/preview.php') ->actionInclude('files_trashbin/ajax/preview.php'); $this->create('files_trashbin_ajax_delete', 'ajax/delete.php') @@ -33,6 +37,3 @@ $this->create('files_trashbin_ajax_list', 'ajax/list.php') $this->create('files_trashbin_ajax_undelete', 'ajax/undelete.php') ->actionInclude('files_trashbin/ajax/undelete.php'); - -// Register with the capabilities API -\OCP\API::register('get', '/cloud/capabilities', array('OCA\Files_Trashbin\Capabilities', 'getCapabilities'), 'files_trashbin', \OCP\API::USER_AUTH); diff --git a/apps/files_trashbin/lib/capabilities.php b/apps/files_trashbin/lib/capabilities.php index 89b268489b5..c991cc8be65 100644 --- a/apps/files_trashbin/lib/capabilities.php +++ b/apps/files_trashbin/lib/capabilities.php @@ -2,6 +2,7 @@ /** * @author Lukas Reschke <lukas@owncloud.com> * @author Morris Jobke <hey@morrisjobke.de> + * @author Roeland Jago Douma <roeland@famdouma.nl> * * @copyright Copyright (c) 2015, ownCloud, Inc. * @license AGPL-3.0 @@ -22,25 +23,26 @@ namespace OCA\Files_Trashbin; +use OCP\Capabilities\ICapability; /** * Class Capabilities * * @package OCA\Files_Trashbin */ -class Capabilities { +class Capabilities implements ICapability { /** - * @return \OC_OCS_Result + * Return this classes capabilities + * + * @return array */ - public static function getCapabilities() { - return new \OC_OCS_Result(array( - 'capabilities' => array( - 'files' => array( - 'undelete' => true, - ), - ), - )); + public function getCapabilities() { + return [ + 'files' => [ + 'undelete' => true + ] + ]; } } |