summaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin/lib/Sabre/RootCollection.php
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2018-10-23 17:11:16 +0200
committerGitHub <noreply@github.com>2018-10-23 17:11:16 +0200
commit4ad27260a92961e9893d8351f607e1714f73007f (patch)
treefb5a6aa474e30e83b779ba9cf92100bd6432f78e /apps/files_trashbin/lib/Sabre/RootCollection.php
parente0f9257be933ae8605424aaf5a08860cfd4359ff (diff)
parent9e0ebf183044f00d7e1e3b30c9a01e84d051dd78 (diff)
downloadnextcloud-server-4ad27260a92961e9893d8351f607e1714f73007f.tar.gz
nextcloud-server-4ad27260a92961e9893d8351f607e1714f73007f.zip
Merge pull request #11439 from nextcloud/trash-modular-api
Modular trashbin api
Diffstat (limited to 'apps/files_trashbin/lib/Sabre/RootCollection.php')
-rw-r--r--apps/files_trashbin/lib/Sabre/RootCollection.php15
1 files changed, 12 insertions, 3 deletions
diff --git a/apps/files_trashbin/lib/Sabre/RootCollection.php b/apps/files_trashbin/lib/Sabre/RootCollection.php
index be31d200f71..0b55953aa3f 100644
--- a/apps/files_trashbin/lib/Sabre/RootCollection.php
+++ b/apps/files_trashbin/lib/Sabre/RootCollection.php
@@ -21,18 +21,27 @@ declare(strict_types=1);
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
+
namespace OCA\Files_Trashbin\Sabre;
+use OCA\Files_Trashbin\Trash\ITrashManager;
use OCP\IConfig;
use Sabre\DAV\INode;
use Sabre\DAVACL\AbstractPrincipalCollection;
use Sabre\DAVACL\PrincipalBackend;
class RootCollection extends AbstractPrincipalCollection {
+ /** @var ITrashManager */
+ private $trashManager;
- public function __construct(PrincipalBackend\BackendInterface $principalBackend, IConfig $config) {
+ public function __construct(
+ ITrashManager $trashManager,
+ PrincipalBackend\BackendInterface $principalBackend,
+ IConfig $config
+ ) {
parent::__construct($principalBackend, 'principals/users');
+ $this->trashManager = $trashManager;
$this->disableListing = !$config->getSystemValue('debug', false);
}
@@ -47,12 +56,12 @@ class RootCollection extends AbstractPrincipalCollection {
* @return INode
*/
public function getChildForPrincipal(array $principalInfo): TrashHome {
- list(,$name) = \Sabre\Uri\split($principalInfo['uri']);
+ list(, $name) = \Sabre\Uri\split($principalInfo['uri']);
$user = \OC::$server->getUserSession()->getUser();
if (is_null($user) || $name !== $user->getUID()) {
throw new \Sabre\DAV\Exception\Forbidden();
}
- return new TrashHome($principalInfo);
+ return new TrashHome($principalInfo, $this->trashManager, $user);
}
public function getName(): string {