[Pkg-owncloud-commits] [owncloud] 147/199: extend OCS Share API to allow the user to ask for files shared with him
David Prévot
taffit at moszumanska.debian.org
Sun Jun 1 18:53:20 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository owncloud.
commit dbbb6c5945f9c4d73695fa210be88d35ff35f026
Author: Bjoern Schiessle <schiessle at owncloud.com>
Date: Mon May 5 15:02:49 2014 +0200
extend OCS Share API to allow the user to ask for files shared with him
---
apps/files_sharing/lib/api.php | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/apps/files_sharing/lib/api.php b/apps/files_sharing/lib/api.php
index 21fd5d0..10b3f76 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
--
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