FilesHome.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  6. * @author Morris Jobke <hey@morrisjobke.de>
  7. * @author Robin Appelman <robin@icewind.nl>
  8. * @author Thomas Müller <thomas.mueller@tmit.eu>
  9. * @author Vincent Petry <vincent@nextcloud.com>
  10. *
  11. * @license AGPL-3.0
  12. *
  13. * This code is free software: you can redistribute it and/or modify
  14. * it under the terms of the GNU Affero General Public License, version 3,
  15. * as published by the Free Software Foundation.
  16. *
  17. * This program is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. * GNU Affero General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Affero General Public License, version 3,
  23. * along with this program. If not, see <http://www.gnu.org/licenses/>
  24. *
  25. */
  26. namespace OCA\DAV\Files;
  27. use OCA\DAV\Connector\Sabre\Directory;
  28. use OCP\Files\FileInfo;
  29. use Sabre\DAV\Exception\Forbidden;
  30. class FilesHome extends Directory {
  31. /**
  32. * @var array
  33. */
  34. private $principalInfo;
  35. /**
  36. * FilesHome constructor.
  37. *
  38. * @param array $principalInfo
  39. * @param FileInfo $userFolder
  40. */
  41. public function __construct($principalInfo, FileInfo $userFolder) {
  42. $this->principalInfo = $principalInfo;
  43. $view = \OC\Files\Filesystem::getView();
  44. parent::__construct($view, $userFolder);
  45. }
  46. public function delete() {
  47. throw new Forbidden('Permission denied to delete home folder');
  48. }
  49. public function getName() {
  50. [,$name] = \Sabre\Uri\split($this->principalInfo['uri']);
  51. return $name;
  52. }
  53. public function setName($name) {
  54. throw new Forbidden('Permission denied to rename this folder');
  55. }
  56. }