From 61641293f47914413179b60c8124e5e966c772bb Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 18 Nov 2014 23:06:39 +0100 Subject: [PATCH] Only show undelete capability if files_trashbin is enabled Fixes the OCS capability API at /ocs/v1.php/cloud/capabilities --- apps/files/lib/capabilities.php | 1 - apps/files_trashbin/appinfo/routes.php | 4 +++ apps/files_trashbin/lib/capabilities.php | 32 ++++++++++++++++++++++++ 3 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 apps/files_trashbin/lib/capabilities.php diff --git a/apps/files/lib/capabilities.php b/apps/files/lib/capabilities.php index d4820e931ba..690cc314ccd 100644 --- a/apps/files/lib/capabilities.php +++ b/apps/files/lib/capabilities.php @@ -15,7 +15,6 @@ class Capabilities { 'capabilities' => array( 'files' => array( 'bigfilechunking' => true, - 'undelete' => true, ), ), )); diff --git a/apps/files_trashbin/appinfo/routes.php b/apps/files_trashbin/appinfo/routes.php index da268f4fdfd..56dbf382735 100644 --- a/apps/files_trashbin/appinfo/routes.php +++ b/apps/files_trashbin/appinfo/routes.php @@ -13,3 +13,7 @@ $this->create('files_trashbin_ajax_list', 'ajax/list.php') ->actionInclude('files_trashbin/ajax/list.php'); $this->create('files_trashbin_ajax_undelete', 'ajax/undelete.php') ->actionInclude('files_trashbin/ajax/undelete.php'); + + +// Register with the capabilities API +\OC_API::register('get', '/cloud/capabilities', array('OCA\Files_Trashbin\Capabilities', 'getCapabilities'), 'files_trashbin', \OC_API::USER_AUTH); diff --git a/apps/files_trashbin/lib/capabilities.php b/apps/files_trashbin/lib/capabilities.php new file mode 100644 index 00000000000..3f137d22b6f --- /dev/null +++ b/apps/files_trashbin/lib/capabilities.php @@ -0,0 +1,32 @@ + + * This file is licensed under the Affero General Public License version 3 or + * later. + * See the COPYING-README file. + */ + +namespace OCA\Files_Trashbin; + + +/** + * Class Capabilities + * + * @package OCA\Files_Trashbin + */ +class Capabilities { + + /** + * @return \OC_OCS_Result + */ + public static function getCapabilities() { + return new \OC_OCS_Result(array( + 'capabilities' => array( + 'files' => array( + 'undelete' => true, + ), + ), + )); + } + +} -- 2.39.5