FilesHome.php 952 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCA\DAV\Files;
  8. use OC\Files\Filesystem;
  9. use OCA\DAV\Connector\Sabre\Directory;
  10. use OCP\Files\FileInfo;
  11. use Sabre\DAV\Exception\Forbidden;
  12. class FilesHome extends Directory {
  13. /**
  14. * FilesHome constructor.
  15. *
  16. * @param array $principalInfo
  17. * @param FileInfo $userFolder
  18. */
  19. public function __construct(
  20. private $principalInfo,
  21. FileInfo $userFolder,
  22. ) {
  23. $view = Filesystem::getView();
  24. parent::__construct($view, $userFolder);
  25. }
  26. public function delete() {
  27. throw new Forbidden('Permission denied to delete home folder');
  28. }
  29. public function getName() {
  30. [,$name] = \Sabre\Uri\split($this->principalInfo['uri']);
  31. return $name;
  32. }
  33. public function setName($name) {
  34. throw new Forbidden('Permission denied to rename this folder');
  35. }
  36. }