IRootFolder.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Bernhard Posselt <dev@bernhard-posselt.com>
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. * @author Julius Härtl <jus@bitgrid.net>
  8. * @author Morris Jobke <hey@morrisjobke.de>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCP\Files;
  26. use OC\Hooks\Emitter;
  27. use OC\User\NoUserException;
  28. use OCP\Files\Cache\ICacheEntry;
  29. use OCP\Files\Mount\IMountPoint;
  30. use OCP\Files\Node as INode;
  31. /**
  32. * Interface IRootFolder
  33. *
  34. * @since 8.0.0
  35. */
  36. interface IRootFolder extends Folder, Emitter {
  37. /**
  38. * Returns a view to user's files folder
  39. *
  40. * @param string $userId user ID
  41. * @return Folder
  42. * @throws NoUserException
  43. * @throws NotPermittedException
  44. *
  45. * @since 8.2.0
  46. */
  47. public function getUserFolder($userId);
  48. /**
  49. * Get a file or folder by fileid, inside a parent path
  50. *
  51. * @param int $id
  52. * @param string $path
  53. * @return Node[]
  54. *
  55. * @since 24.0.0
  56. */
  57. public function getByIdInPath(int $id, string $path);
  58. /**
  59. * get a file or folder inside the folder by its internal id
  60. *
  61. * Unlike getByIdInPath, this method only returns a single node even if the user has
  62. * access to the file with the requested id multiple times.
  63. *
  64. * This method provides no guarantee about which of the nodes in returned and the
  65. * returned node might, for example, have less permissions than other nodes for the same file
  66. *
  67. * Apps that require accurate information about the users access to the file should use getByIdInPath
  68. * instead of pick the correct node out of the result.
  69. *
  70. * @param int $id
  71. * @return Node|null
  72. * @since 29.0.0
  73. */
  74. public function getFirstNodeByIdInPath(int $id, string $path): ?Node;
  75. /**
  76. * @return IMountPoint[]
  77. *
  78. * @since 28.0.0
  79. */
  80. public function getMountsIn(string $mountPoint): array;
  81. /**
  82. * Create a `Node` for a file or folder from the cache entry and mountpoint
  83. *
  84. * @param ICacheEntry $cacheEntry
  85. * @param IMountPoint $mountPoint
  86. * @return Node
  87. * @since 28.0.0
  88. */
  89. public function getNodeFromCacheEntryAndMount(ICacheEntry $cacheEntry, IMountPoint $mountPoint): INode;
  90. /**
  91. * @since 28.0.0
  92. */
  93. public function getMount(string $mountPoint): IMountPoint;
  94. }