FilesHome.php 1013 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 OCA\DAV\Connector\Sabre\Directory;
  9. use OCP\Files\FileInfo;
  10. use Sabre\DAV\Exception\Forbidden;
  11. class FilesHome extends Directory {
  12. /**
  13. * @var array
  14. */
  15. private $principalInfo;
  16. /**
  17. * FilesHome constructor.
  18. *
  19. * @param array $principalInfo
  20. * @param FileInfo $userFolder
  21. */
  22. public function __construct($principalInfo, FileInfo $userFolder) {
  23. $this->principalInfo = $principalInfo;
  24. $view = \OC\Files\Filesystem::getView();
  25. parent::__construct($view, $userFolder);
  26. }
  27. public function delete() {
  28. throw new Forbidden('Permission denied to delete home folder');
  29. }
  30. public function getName() {
  31. [,$name] = \Sabre\Uri\split($this->principalInfo['uri']);
  32. return $name;
  33. }
  34. public function setName($name) {
  35. throw new Forbidden('Permission denied to rename this folder');
  36. }
  37. }