summaryrefslogtreecommitdiffstats
path: root/apps/files_versions/lib/Sabre/RootCollection.php
diff options
context:
space:
mode:
authorRobin Appelman <robin@icewind.nl>2018-10-12 17:42:08 +0200
committerRobin Appelman <robin@icewind.nl>2018-11-01 00:21:48 +0100
commit4403d771ad72b3de62e6ba5ea8822110253c578e (patch)
tree169d10594adf85c5ca7881a983c8568d9bf53762 /apps/files_versions/lib/Sabre/RootCollection.php
parent4a642fc0048c03a24aa199ccc9df23d547f69aa2 (diff)
downloadnextcloud-server-4403d771ad72b3de62e6ba5ea8822110253c578e.tar.gz
nextcloud-server-4403d771ad72b3de62e6ba5ea8822110253c578e.zip
modular versions api
Allows apps to register version backends for storage types The existing versions backend is wrapped in a "legacy" backend. Signed-off-by: Robin Appelman <robin@icewind.nl>
Diffstat (limited to 'apps/files_versions/lib/Sabre/RootCollection.php')
-rw-r--r--apps/files_versions/lib/Sabre/RootCollection.php25
1 files changed, 20 insertions, 5 deletions
diff --git a/apps/files_versions/lib/Sabre/RootCollection.php b/apps/files_versions/lib/Sabre/RootCollection.php
index ca5979573b5..504c3362505 100644
--- a/apps/files_versions/lib/Sabre/RootCollection.php
+++ b/apps/files_versions/lib/Sabre/RootCollection.php
@@ -20,10 +20,13 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
+
namespace OCA\Files_Versions\Sabre;
+use OCA\Files_Versions\Versions\IVersionManager;
use OCP\Files\IRootFolder;
use OCP\IConfig;
+use OCP\IUserManager;
use Sabre\DAV\INode;
use Sabre\DAVACL\AbstractPrincipalCollection;
use Sabre\DAVACL\PrincipalBackend;
@@ -33,12 +36,24 @@ class RootCollection extends AbstractPrincipalCollection {
/** @var IRootFolder */
private $rootFolder;
- public function __construct(PrincipalBackend\BackendInterface $principalBackend,
- IRootFolder $rootFolder,
- IConfig $config) {
+ /** @var IUserManager */
+ private $userManager;
+
+ /** @var IVersionManager */
+ private $versionManager;
+
+ public function __construct(
+ PrincipalBackend\BackendInterface $principalBackend,
+ IRootFolder $rootFolder,
+ IConfig $config,
+ IUserManager $userManager,
+ IVersionManager $versionManager
+ ) {
parent::__construct($principalBackend, 'principals/users');
$this->rootFolder = $rootFolder;
+ $this->userManager = $userManager;
+ $this->versionManager = $versionManager;
$this->disableListing = !$config->getSystemValue('debug', false);
}
@@ -54,12 +69,12 @@ class RootCollection extends AbstractPrincipalCollection {
* @return INode
*/
public function getChildForPrincipal(array $principalInfo) {
- 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 VersionHome($principalInfo, $this->rootFolder);
+ return new VersionHome($principalInfo, $this->rootFolder, $this->userManager, $this->versionManager);
}
public function getName() {