You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

FilesHome.php 1.8KB

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