summaryrefslogtreecommitdiffstats
path: root/lib/private/share20/manager.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/private/share20/manager.php')
-rw-r--r--lib/private/share20/manager.php39
1 files changed, 34 insertions, 5 deletions
diff --git a/lib/private/share20/manager.php b/lib/private/share20/manager.php
index 2be8fb5174d..7d454b26f00 100644
--- a/lib/private/share20/manager.php
+++ b/lib/private/share20/manager.php
@@ -605,14 +605,43 @@ class Manager {
\OC_Hook::emit('OCP\Share', 'post_unshare', $hookParams);
}
+
/**
- * Retrieve all shares by the current user
+ * Get shares shared by (initiated) by the provided user.
*
- * @param int $page
- * @param int $perPage
- * @return Share[]
+ * @param IUser $user
+ * @param int $shareType
+ * @param \OCP\Files\File|\OCP\Files\Folder $path
+ * @param bool $reshares
+ * @param int $limit The maximum number of returned results, -1 for all results
+ * @param int $offset
+ * @return IShare[]
*/
- public function getShares($page=0, $perPage=50) {
+ public function getSharesBy(IUser $user, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0) {
+ if ($path !== null &&
+ !($path instanceof \OCP\Files\File) &&
+ !($path instanceof \OCP\Files\Folder)) {
+ throw new \InvalidArgumentException('invalid path');
+ }
+
+ $provider = $this->factory->getProviderForType($shareType);
+
+ return $provider->getSharesBy($user, $shareType, $path, $reshares, $limit, $offset);
+ }
+
+ /**
+ * Get shares shared with $user.
+ *
+ * @param IUser $user
+ * @param int $shareType
+ * @param int $limit The maximum number of shares returned, -1 for all
+ * @param int $offset
+ * @return IShare[]
+ */
+ public function getSharedWith(IUser $user, $shareType, $limit = 50, $offset = 0) {
+ $provider = $this->factory->getProviderForType($shareType);
+
+ return $provider->getSharedWith($user, $shareType, $limit, $offset);
}
/**