Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Mar 20, 2017
1 parent 24fd574 commit 9e12f9c
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 3 deletions.
5 changes: 5 additions & 0 deletions lib/private/AppFramework/DependencyInjection/DIContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
use OCP\Files\IAppData;
use OCP\Files\Mount\IMountManager;
use OCP\RichObjectStrings\IValidator;
use OCP\Share\IShareHelper;
use OCP\Util;

class DIContainer extends SimpleContainer implements IAppContainer {
Expand Down Expand Up @@ -363,6 +364,10 @@ public function __construct($appName, $urlParams = array()){
);
});

$this->registerService(IShareHelper::class, function (SimpleContainer $c) {
return $c->query(IShareHelper::class);
});


/**
* App Framework APIs
Expand Down
2 changes: 1 addition & 1 deletion lib/private/Encryption/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function getAccessList($path) {
// Find out who, if anyone, is sharing the file
if ($file !== null) {
$resultForFile = $this->shareManager->getAccessList($file, false);
$userIds = \array_merge($userIds, $resultForFile['users']);
$userIds = array_merge($userIds, $resultForFile['users']);
$public = $resultForFile['public'] || $resultForFile['remote'] || $public;
}

Expand Down
8 changes: 8 additions & 0 deletions lib/private/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
use OC\Security\SecureRandom;
use OC\Security\TrustedDomainHelper;
use OC\Session\CryptoWrapper;
use OC\Share20\ShareHelper;
use OC\Tagging\TagMapper;
use OCA\Theming\ThemingDefaults;
use OCP\Federation\ICloudIdManager;
Expand All @@ -97,6 +98,7 @@
use OCP\IServerContainer;
use OCP\RichObjectStrings\IValidator;
use OCP\Security\IContentSecurityPolicyManager;
use OCP\Share\IShareHelper;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;

Expand Down Expand Up @@ -845,6 +847,12 @@ public function __construct($webRoot, \OC\Config $config) {
new TimeFactory()
);
});

$this->registerService(IShareHelper::class, function(Server $c) {
return new ShareHelper(
$c->getLazyRootFolder()
);
});
}

/**
Expand Down
5 changes: 3 additions & 2 deletions lib/public/Share/IManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,10 +216,11 @@ public function userDeletedFromGroup($uid, $gid);
*
* @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 9.2.0
* @since 12
*/
public function getAccessList(\OCP\Files\Node $path, $recursive = true);
public function getAccessList(\OCP\Files\Node $path, $recursive = true, $currentAccess = false);

/**
* Instantiates a new share object. This is to be passed to
Expand Down
44 changes: 44 additions & 0 deletions lib/public/Share/IShareHelper.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?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 {

/**
* If a user has access to a file
*
* @param Node $node
* @param array $users Array of userIds
* @return array Mapping $uid to an array of nodes
* @since 12
*/
public function getPathsForAccessList(Node $node, $users);
}

0 comments on commit 9e12f9c

Please sign in to comment.