summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2017-04-20 14:34:28 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2017-04-20 14:34:28 +0200
commit4004e39f75467497919b78abf0ff13e14c60b8d6 (patch)
tree2cc7f35fff43dbaa9460677a11b051fc505d63c0
parent799b229a68d3478809c084d58b69288061139ab1 (diff)
downloadnextcloud-server-4004e39f75467497919b78abf0ff13e14c60b8d6.tar.gz
nextcloud-server-4004e39f75467497919b78abf0ff13e14c60b8d6.zip
Move systemtags and comments to new accesslist functions
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r--apps/comments/lib/Activity/Listener.php16
-rw-r--r--apps/systemtags/lib/Activity/Listener.php16
2 files changed, 18 insertions, 14 deletions
diff --git a/apps/comments/lib/Activity/Listener.php b/apps/comments/lib/Activity/Listener.php
index 2ac49144690..16852296cf1 100644
--- a/apps/comments/lib/Activity/Listener.php
+++ b/apps/comments/lib/Activity/Listener.php
@@ -31,6 +31,7 @@ use OCP\Files\Node;
use OCP\IUser;
use OCP\IUserSession;
use OCP\Share;
+use OCP\Share\IShareHelper;
class Listener {
/** @var IManager */
@@ -43,6 +44,8 @@ class Listener {
protected $mountCollection;
/** @var \OCP\Files\IRootFolder */
protected $rootFolder;
+ /** @var IShareHelper */
+ protected $shareHelper;
/**
* Listener constructor.
@@ -52,17 +55,20 @@ class Listener {
* @param IAppManager $appManager
* @param IMountProviderCollection $mountCollection
* @param IRootFolder $rootFolder
+ * @param IShareHelper $shareHelper
*/
public function __construct(IManager $activityManager,
IUserSession $session,
IAppManager $appManager,
IMountProviderCollection $mountCollection,
- IRootFolder $rootFolder) {
+ IRootFolder $rootFolder,
+ IShareHelper $shareHelper) {
$this->activityManager = $activityManager;
$this->session = $session;
$this->appManager = $appManager;
$this->mountCollection = $mountCollection;
$this->rootFolder = $rootFolder;
+ $this->shareHelper = $shareHelper;
}
/**
@@ -91,12 +97,8 @@ class Listener {
if (!empty($nodes)) {
/** @var Node $node */
$node = array_shift($nodes);
- $path = $node->getPath();
- if (strpos($path, '/' . $owner . '/files/') === 0) {
- $path = substr($path, strlen('/' . $owner . '/files'));
- }
- // Get all users that have access to the mount point
- $users = array_merge($users, Share::getUsersSharingFile($path, $owner, true, true));
+ $al = $this->shareHelper->getPathsForAccessList($node);
+ $users = array_merge($users, $al['users']);
}
}
diff --git a/apps/systemtags/lib/Activity/Listener.php b/apps/systemtags/lib/Activity/Listener.php
index 152608f7cce..0fb5d4c12be 100644
--- a/apps/systemtags/lib/Activity/Listener.php
+++ b/apps/systemtags/lib/Activity/Listener.php
@@ -34,6 +34,7 @@ use OCP\IGroupManager;
use OCP\IUser;
use OCP\IUserSession;
use OCP\Share;
+use OCP\Share\IShareHelper;
use OCP\SystemTag\ISystemTag;
use OCP\SystemTag\ISystemTagManager;
use OCP\SystemTag\ManagerEvent;
@@ -57,6 +58,8 @@ class Listener {
protected $mountCollection;
/** @var \OCP\Files\IRootFolder */
protected $rootFolder;
+ /** @var IShareHelper */
+ protected $shareHelper;
/**
* Listener constructor.
@@ -69,6 +72,7 @@ class Listener {
* @param IAppManager $appManager
* @param IMountProviderCollection $mountCollection
* @param IRootFolder $rootFolder
+ * @param IShareHelper $shareHelper
*/
public function __construct(IGroupManager $groupManager,
IManager $activityManager,
@@ -77,7 +81,8 @@ class Listener {
ISystemTagManager $tagManager,
IAppManager $appManager,
IMountProviderCollection $mountCollection,
- IRootFolder $rootFolder) {
+ IRootFolder $rootFolder,
+ IShareHelper $shareHelper) {
$this->groupManager = $groupManager;
$this->activityManager = $activityManager;
$this->session = $session;
@@ -86,6 +91,7 @@ class Listener {
$this->appManager = $appManager;
$this->mountCollection = $mountCollection;
$this->rootFolder = $rootFolder;
+ $this->shareHelper = $shareHelper;
}
/**
@@ -177,12 +183,8 @@ class Listener {
if (!empty($nodes)) {
/** @var Node $node */
$node = array_shift($nodes);
- $path = $node->getPath();
- if (strpos($path, '/' . $owner . '/files/') === 0) {
- $path = substr($path, strlen('/' . $owner . '/files'));
- }
- // Get all users that have access to the mount point
- $users = array_merge($users, Share::getUsersSharingFile($path, $owner, true, true));
+ $al = $this->shareHelper->getPathsForAccessList($node);
+ $users = array_merge($users, $al['users']);
}
}