From c4e0fb75a4e8c9cb133ce79b6a737b2ba7b161df Mon Sep 17 00:00:00 2001
From: Bjoern Schiessle <schiessle@owncloud.com>
Date: Tue, 8 Apr 2014 14:42:15 +0200
Subject: [PATCH] add api to get shares from a specific user

---
 lib/private/share/share.php | 16 ++++++++++++++++
 lib/public/share.php        | 16 ++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/lib/private/share/share.php b/lib/private/share/share.php
index 3751b035bd..ff56b9a48f 100644
--- a/lib/private/share/share.php
+++ b/lib/private/share/share.php
@@ -252,6 +252,22 @@ class Share extends \OC\Share\Constants {
 			$parameters, $limit, $includeCollections);
 	}
 
+	/**
+	 * Get the items of item type shared with a user
+	 * @param string Item type
+	 * @param sting user id for which user we want the shares
+	 * @param int Format (optional) Format type must be defined by the backend
+	 * @param mixed Parameters (optional)
+	 * @param int Number of items to return (optional) Returns all by default
+	 * @param bool include collections (optional)
+	 * @return Return depends on format
+	 */
+	public static function getItemsSharedWithUser($itemType, $user, $format = self::FORMAT_NONE,
+		$parameters = null, $limit = -1, $includeCollections = false) {
+		return self::getItems($itemType, null, self::$shareTypeUserAndGroups, $user, null, $format,
+			$parameters, $limit, $includeCollections);
+	}
+
 	/**
 	 * Get the item of item type shared with the current user
 	 * @param string $itemType
diff --git a/lib/public/share.php b/lib/public/share.php
index c694314ad0..230a517b5e 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -90,6 +90,22 @@ class Share extends \OC\Share\Constants {
 		return \OC\Share\Share::getItemsSharedWith($itemType, $format, $parameters, $limit, $includeCollections);
 	}
 
+	/**
+	 * Get the items of item type shared with a user
+	 * @param string Item type
+	 * @param sting user id for which user we want the shares
+	 * @param int Format (optional) Format type must be defined by the backend
+	 * @param mixed Parameters (optional)
+	 * @param int Number of items to return (optional) Returns all by default
+	 * @param bool include collections (optional)
+	 * @return Return depends on format
+	 */
+	public static function getItemsSharedWithUser($itemType, $user, $format = self::FORMAT_NONE,
+		$parameters = null, $limit = -1, $includeCollections = false) {
+
+		return \OC\Share\Share::getItemsSharedWithUser($itemType, $user, $format, $parameters, $limit, $includeCollections);
+	}
+
 	/**
 	 * Get the item of item type shared with the current user
 	 * @param string $itemType
-- 
GitLab