diff options
author | Robin Appelman <robin@icewind.nl> | 2018-09-10 14:40:35 +0200 |
---|---|---|
committer | Robin Appelman <robin@icewind.nl> | 2018-10-17 14:56:45 +0200 |
commit | 4adac445dc57d1ccc7f26e21018e1e731e5b1654 (patch) | |
tree | b3da061a9332a1ebca2809a61ea3cf186d9fb259 /apps/files_trashbin/lib/Sabre/RootCollection.php | |
parent | 2634ceb35b72eac94e6bf4c61640036392c5f97f (diff) | |
download | nextcloud-server-4adac445dc57d1ccc7f26e21018e1e731e5b1654.tar.gz nextcloud-server-4adac445dc57d1ccc7f26e21018e1e731e5b1654.zip |
fix select statement
fix select statement
Make trashbin api modules
Apps can register trashbin backends for specific storages,
allowing them to modify trashbin behavior for storages
The old trashbin implementation has been wrapped in a "legacy" backend,
for future work this can be replaced with a new backend that better handles
shares while still keeping the legacy backend around to keep existing trash
from being accessible
Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_trashbin/lib/Sabre/RootCollection.php')
-rw-r--r-- | apps/files_trashbin/lib/Sabre/RootCollection.php | 15 |
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 { |