Browse Source

Added to public interface

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
tags/v12.0.0beta1
Roeland Jago Douma 7 years ago
parent
commit
88299ec27c
No account linked to committer's email address
3 changed files with 41 additions and 8 deletions
  1. 0
    4
      .htaccess
  2. 11
    4
      lib/private/Share20/Manager.php
  3. 30
    0
      lib/public/Share/IManager.php

+ 0
- 4
.htaccess View File

@@ -78,7 +78,3 @@ Options -Indexes
<IfModule pagespeed_module>
ModPagespeed Off
</IfModule>
#### DO NOT CHANGE ANYTHING ABOVE THIS LINE ####

ErrorDocument 403 /core/templates/403.php
ErrorDocument 404 /core/templates/404.php

+ 11
- 4
lib/private/Share20/Manager.php View File

@@ -1196,17 +1196,21 @@ class Manager implements IManager {
* remote => bool
* ]
*
* This is required for encryption/activities
* This is required for encryption/activity
*
* @param \OCP\Files\Node $path
* @param bool $recursive Should we check all parent folders as well
* @return array
*/
public function getAccessList(\OCP\Files\Node $path) {
public function getAccessList(\OCP\Files\Node $path, $recursive = true) {
$owner = $path->getOwner()->getUID();

//Get node for the owner
$userFolder = $this->rootFolder->getUserFolder($owner);
$path = $userFolder->getById($path->getId())[0];

if (!$userFolder->isSubNode($path)) {
$path = $userFolder->getById($path->getId())[0];
}

$providers = $this->factory->getAllProviders();

@@ -1214,10 +1218,13 @@ class Manager implements IManager {
$shares = [];

// Collect all the shares
while ($path !== $userFolder) {
while ($path->getPath() !== $userFolder->getPath()) {
foreach ($providers as $provider) {
$shares = array_merge($shares, $provider->getSharesByPath($path));
}
if (!$recursive) {
break;
}
$path = $path->getParent();
}


+ 30
- 0
lib/public/Share/IManager.php View File

@@ -191,6 +191,36 @@ 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
* |-folder2
* |-fileA
*
* fileA is shared with user1
* folder2 is shared with group2 (user4 is a member of group2)
* folder1 is shared with user2
*
* Then the access list will to '/folder1/folder2/fileA' is:
* [
* users => ['user1', 'user2', 'user4'],
* public => bool
* remote => bool
* ]
*
* This is required for encryption/activity
*
* @param \OCP\Files\Node $path
* @param bool $recursive Should we check all parent folders as well
* @return array
* @since 9.2.0
*/
public function getAccessList(\OCP\Files\Node $path, $recursive = true);

/**
* Instantiates a new share object. This is to be passed to
* createShare.

Loading…
Cancel
Save