summaryrefslogtreecommitdiffstats
path: root/lib/public/Share
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Share')
-rw-r--r--lib/public/Share/IManager.php47
-rw-r--r--lib/public/Share/IShare.php2
-rw-r--r--lib/public/Share/IShareHelper.php41
-rw-r--r--lib/public/Share/IShareProvider.php12
4 files changed, 101 insertions, 1 deletions
diff --git a/lib/public/Share/IManager.php b/lib/public/Share/IManager.php
index a15020bbd69..31f04803066 100644
--- a/lib/public/Share/IManager.php
+++ b/lib/public/Share/IManager.php
@@ -192,6 +192,53 @@ interface IManager {
public function userDeletedFromGroup($uid, $gid);
/**
+ * Get access list to a path. This means
+ * all the users that can access a given path.
+ *
+ * Consider:
+ * -root
+ * |-folder1 (23)
+ * |-folder2 (32)
+ * |-fileA (42)
+ *
+ * fileA is shared with user1 and user1@server1
+ * folder2 is shared with group2 (user4 is a member of group2)
+ * folder1 is shared with user2 (renamed to "folder (1)") and user2@server2
+ *
+ * Then the access list to '/folder1/folder2/fileA' with $currentAccess is:
+ * [
+ * users => [
+ * 'user1' => ['node_id' => 42, 'node_path' => '/fileA'],
+ * 'user4' => ['node_id' => 32, 'node_path' => '/folder2'],
+ * 'user2' => ['node_id' => 23, 'node_path' => '/folder (1)'],
+ * ],
+ * remote => [
+ * 'user1@server1' => ['node_id' => 42, 'token' => 'SeCr3t'],
+ * 'user2@server2' => ['node_id' => 23, 'token' => 'FooBaR'],
+ * ],
+ * public => bool
+ * mail => bool
+ * ]
+ *
+ * The access list to '/folder1/folder2/fileA' **without** $currentAccess is:
+ * [
+ * users => ['user1', 'user2', 'user4'],
+ * remote => bool,
+ * public => bool
+ * mail => bool
+ * ]
+ *
+ * This is required for encryption/activity
+ *
+ * @param \OCP\Files\Node $path
+ * @param bool $recursive Should we check all parent folders as well
+ * @param bool $currentAccess Should the user have currently access to the file
+ * @return array
+ * @since 12
+ */
+ public function getAccessList(\OCP\Files\Node $path, $recursive = true, $currentAccess = false);
+
+ /**
* Instantiates a new share object. This is to be passed to
* createShare.
*
diff --git a/lib/public/Share/IShare.php b/lib/public/Share/IShare.php
index 5b552b51c3c..8deec573c1b 100644
--- a/lib/public/Share/IShare.php
+++ b/lib/public/Share/IShare.php
@@ -189,7 +189,7 @@ interface IShare {
/**
* Set the expiration date
*
- * @param \DateTime $expireDate
+ * @param null|\DateTime $expireDate
* @return \OCP\Share\IShare The modified object
* @since 9.0.0
*/
diff --git a/lib/public/Share/IShareHelper.php b/lib/public/Share/IShareHelper.php
new file mode 100644
index 00000000000..4ec62830c52
--- /dev/null
+++ b/lib/public/Share/IShareHelper.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * @copyright 2017, Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @author Roeland Jago Douma <roeland@famdouma.nl>
+ *
+ * @license GNU AGPL version 3 or any later version
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+namespace OCP\Share;
+
+use OCP\Files\Node;
+
+/**
+ * Interface IShareHelper
+ *
+ * @package OCP\Share
+ * @since 12
+ */
+interface IShareHelper {
+
+ /**
+ * @param Node $node
+ * @return array [ users => [Mapping $uid => $pathForUser], remotes => [Mapping $cloudId => $pathToMountRoot]]
+ * @since 12
+ */
+ public function getPathsForAccessList(Node $node);
+}
diff --git a/lib/public/Share/IShareProvider.php b/lib/public/Share/IShareProvider.php
index 6257c97eb77..31808206cf6 100644
--- a/lib/public/Share/IShareProvider.php
+++ b/lib/public/Share/IShareProvider.php
@@ -190,4 +190,16 @@ interface IShareProvider {
* @since 9.1.0
*/
public function userDeletedFromGroup($uid, $gid);
+
+ /**
+ * Get the access list to the array of provided nodes.
+ *
+ * @see IManager::getAccessList() for sample docs
+ *
+ * @param Node[] $nodes The list of nodes to get access for
+ * @param bool $currentAccess If current access is required (like for removed shares that might get revived later)
+ * @return array
+ * @since 12
+ */
+ public function getAccessList($nodes, $currentAccess);
}