[Pkg-owncloud-commits] [owncloud] 01/34: Added capabilities whether a server allows public links

David Prévot taffit at moszumanska.debian.org
Wed Mar 11 15:49:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag v8.0.0
in repository owncloud.

commit b3ea849a8704d29fad0a738af8af3430ebb5b3af
Author: Roeland Jago Douma <roeland at famdouma.nl>
Date:   Mon Jan 26 16:09:14 2015 +0100

    Added capabilities whether a server allows public links
    
    This fixes #13673.
    It now lists link sharing, passwords enforced, and if public uploads are
    allowed.
---
 apps/files_sharing/appinfo/routes.php   |  7 +++++
 apps/files_sharing/lib/capabilities.php | 53 +++++++++++++++++++++++++++++++++
 2 files changed, 60 insertions(+)

diff --git a/apps/files_sharing/appinfo/routes.php b/apps/files_sharing/appinfo/routes.php
index dd95095..44ab5c0 100644
--- a/apps/files_sharing/appinfo/routes.php
+++ b/apps/files_sharing/appinfo/routes.php
@@ -56,3 +56,10 @@ $this->create('sharing_external_test_remote', '/testremote')
 		'/apps/files_sharing/api/v1/shares/{id}',
 		array('\OCA\Files_Sharing\API\Local', 'deleteShare'),
 		'files_sharing');
+
+// Register with the capabilities API
+\OC_API::register('get',
+		'/cloud/capabilities',
+		array('OCA\Files_Sharing\Capabilities', 'getCapabilities'),
+		'files_sharing',
+		\OC_API::USER_AUTH);
diff --git a/apps/files_sharing/lib/capabilities.php b/apps/files_sharing/lib/capabilities.php
new file mode 100644
index 0000000..712eb23
--- /dev/null
+++ b/apps/files_sharing/lib/capabilities.php
@@ -0,0 +1,53 @@
+<?php
+/**
+ * Copyright (c) Roeland Jago Douma <roeland at famdouma.nl>
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+ */
+ 
+namespace OCA\Files_Sharing;
+
+
+/**
+ * Class Capabilities
+ *
+ * @package OCA\Files_Sharing
+ */
+class Capabilities {
+
+	/**
+	 * @return \OC_OCS_Result
+	 */
+	public static function getCapabilities() {
+		$config = \OC::$server->getConfig();
+
+		$res = array();
+		if ($config->getAppValue('core', 'shareapi_allow_links', 'yes') === "yes") {
+			$res["allow_links"] = 1;
+
+			if ($config->getAppValue('core', 'shareapi_enforce_links_password', 'yes') === "yes") {
+				$res["enforce_links_password"] = 1;
+			} else {
+				$res["enforce_links_password"] = 0;
+			}
+
+			if ($config->getAppValue('core', 'shareapi_allow_public_upload', 'yes') === "yes") {
+				$res["allow_public_upload"] = 1;
+			} else {
+				$res["allow_public_upload"] = 0;
+			}
+		} else {
+			$res["allow_links"] = 0;
+		}
+		
+		return new \OC_OCS_Result(array(
+			'capabilities' => array(
+				'files' => array(
+					'sharing' => $res
+					),
+				),
+			));
+	}
+	
+}

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list