1
0

FilesHome.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Morris Jobke <hey@morrisjobke.de>
  6. * @author Robin Appelman <robin@icewind.nl>
  7. * @author Roeland Jago Douma <roeland@famdouma.nl>
  8. * @author Thomas Müller <thomas.mueller@tmit.eu>
  9. * @author Vincent Petry <pvince81@owncloud.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. function delete() {
  47. throw new Forbidden('Permission denied to delete home folder');
  48. }
  49. function getName() {
  50. list(,$name) = \Sabre\Uri\split($this->principalInfo['uri']);
  51. return $name;
  52. }
  53. function setName($name) {
  54. throw new Forbidden('Permission denied to rename this folder');
  55. }
  56. }