summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing
diff options
context:
space:
mode:
authorBjoern Schiessle <schiessle@owncloud.com>2014-05-05 15:02:49 +0200
committerVincent Petry <pvince81@owncloud.com>2014-05-30 10:06:28 +0200
commitdbbb6c5945f9c4d73695fa210be88d35ff35f026 (patch)
tree9e86f60bb010aaf1a0d432803f5d196f5bd5064c /apps/files_sharing
parent929882a32a020b6c05605f416fa55024b9a60d33 (diff)
downloadnextcloud-server-dbbb6c5945f9c4d73695fa210be88d35ff35f026.tar.gz
nextcloud-server-dbbb6c5945f9c4d73695fa210be88d35ff35f026.zip
extend OCS Share API to allow the user to ask for files shared with him
Diffstat (limited to 'apps/files_sharing')
-rw-r--r--apps/files_sharing/lib/api.php19
1 files changed, 19 insertions, 0 deletions
diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php
index 21fd5d00a4c..10b3f76db8f 100644
--- a/apps/files_sharing/lib/api.php
+++ b/apps/files_sharing/lib/api.php
@@ -31,6 +31,9 @@ class Api {
* @return \OC_OCS_Result share information
*/
public static function getAllShares($params) {
+ if (isset($_GET['shared_with_me']) && $_GET['shared_with_me'] !== 'false') {
+ return self::getFilesSharedWithMe();
+ }
// if a file is specified, get the share for this file
if (isset($_GET['path'])) {
$params['itemSource'] = self::getFileId($_GET['path']);
@@ -196,6 +199,22 @@ class Api {
}
/**
+ * get files shared with the user
+ * @return \OC_OCS_Result
+ */
+ private static function getFilesSharedWithMe() {
+ try {
+ $shares = \OCP\Share::getItemsSharedWith('file');
+ $result = new \OC_OCS_Result($shares);
+ } catch (\Exception $e) {
+ $result = new \OC_OCS_Result(null, 403, $e->getMessage());
+ }
+
+ return $result;
+
+ }
+
+ /**
* create a new share
* @param array $params
* @return \OC_OCS_Result