summaryrefslogtreecommitdiffstats
path: root/lib/public
diff options
context:
space:
mode:
authorBjörn Schießle <schiessle@owncloud.com>2013-02-12 17:00:33 +0100
committerBjörn Schießle <schiessle@owncloud.com>2013-02-12 17:00:33 +0100
commita692264fa416fec44d774bd955a06a65c7c0d158 (patch)
treed8c511f9e05ff523efe437a877c72fdddbb25360 /lib/public
parentd1bbb30385260d77b01bc5998465ebe68ccd83d7 (diff)
downloadnextcloud-server-a692264fa416fec44d774bd955a06a65c7c0d158.tar.gz
nextcloud-server-a692264fa416fec44d774bd955a06a65c7c0d158.zip
add option to keep duplicates in the list of users with access to a file, e.g. for the unshare operation we need to know if access was granted more than once, for example as group share and as individual share
Diffstat (limited to 'lib/public')
-rw-r--r--lib/public/share.php17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/public/share.php b/lib/public/share.php
index 55ff4d4738f..68f5e93baa7 100644
--- a/lib/public/share.php
+++ b/lib/public/share.php
@@ -145,11 +145,14 @@ class Share {
/**
* @brief Find which users can access a shared item
- * @return bool / array
+ * @param $path to the file
+ * @param include owner to the list of users with access to the file
+ * @param remove duplicates in the result
+ * @return array
* @note $path needs to be relative to user data dir, e.g. 'file.txt'
* not '/admin/data/file.txt'
*/
- public static function getUsersSharingFile( $path, $includeOwner = 0 ) {
+ public static function getUsersSharingFile( $path, $includeOwner = false, $removeDuplicates = true ) {
$user = \OCP\User::getUser();
$path_parts = explode(DIRECTORY_SEPARATOR, trim($path, DIRECTORY_SEPARATOR));
@@ -204,14 +207,16 @@ class Share {
if ( ! empty( $shares ) ) {
// Include owner in list of users, if requested
- if ( $includeOwner == 1 ) {
+ if ( $includeOwner ) {
$shares[] = $user;
}
+ }
+
+ if ( $removeDuplicates )
return array_unique($shares);
- } else {
- return false;
+ else {
+ return $shares;
}
-
}
/**