summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorMichael Gapczynski <mtgap@owncloud.com>2013-02-26 01:21:48 -0500
committerMichael Gapczynski <mtgap@owncloud.com>2013-02-26 01:21:48 -0500
commit8983465210c9dcd91cc178a072775efbcda85ca8 (patch)
treebf8b83b3a98fd30bc7a2f7fa0fbd8e29ff5e963c /lib
parent36827d15498f443819b3aceb503d6cc1b071e041 (diff)
downloadnextcloud-server-8983465210c9dcd91cc178a072775efbcda85ca8.tar.gz
nextcloud-server-8983465210c9dcd91cc178a072775efbcda85ca8.zip
Correct parent folders' ETags for all users with access to a shared file
Diffstat (limited to 'lib')
-rw-r--r--lib/public/share.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index c0f35333e83..3d157b1a5f9 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -198,6 +198,29 @@ class Share {
}
/**
+ * Get all users an item is shared with
+ * @param string Item type
+ * @param string Item source
+ * @param string Owner
+ * @param bool Include collections
+ * @return Return array of users
+ */
+ public static function getUsersItemShared($itemType, $itemSource, $uidOwner, $includeCollections = false) {
+ $users = array();
+ $items = self::getItems($itemType, $itemSource, null, null, $uidOwner, self::FORMAT_NONE, null, -1, $includeCollections);
+ if ($items) {
+ foreach ($items as $item) {
+ if ((int)$item['share_type'] === self::SHARE_TYPE_USER) {
+ $users[] = $item['share_with'];
+ } else if ((int)$item['share_type'] === self::SHARE_TYPE_GROUP) {
+ $users = array_merge($users, \OC_Group::usersInGroup($item['share_with']));
+ }
+ }
+ }
+ return $users;
+ }
+
+ /**
* @brief Share an item with a user, group, or via private link
* @param string Item type
* @param string Item source