IRootFolder.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 OCP\Files;
  8. use OC\Hooks\Emitter;
  9. use OC\User\NoUserException;
  10. use OCP\Files\Cache\ICacheEntry;
  11. use OCP\Files\Mount\IMountPoint;
  12. use OCP\Files\Node as INode;
  13. /**
  14. * Interface IRootFolder
  15. *
  16. * @since 8.0.0
  17. */
  18. interface IRootFolder extends Folder, Emitter {
  19. /**
  20. * Returns a view to user's files folder
  21. *
  22. * @param string $userId user ID
  23. * @return Folder
  24. * @throws NoUserException
  25. * @throws NotPermittedException
  26. *
  27. * @since 8.2.0
  28. */
  29. public function getUserFolder($userId);
  30. /**
  31. * Get a file or folder by fileid, inside a parent path
  32. *
  33. * @param int $id
  34. * @param string $path
  35. * @return Node[]
  36. *
  37. * @since 24.0.0
  38. */
  39. public function getByIdInPath(int $id, string $path);
  40. /**
  41. * get a file or folder inside the folder by its internal id
  42. *
  43. * Unlike getByIdInPath, this method only returns a single node even if the user has
  44. * access to the file with the requested id multiple times.
  45. *
  46. * This method provides no guarantee about which of the nodes in returned and the
  47. * returned node might, for example, have less permissions than other nodes for the same file
  48. *
  49. * Apps that require accurate information about the users access to the file should use getByIdInPath
  50. * instead of pick the correct node out of the result.
  51. *
  52. * @param int $id
  53. * @return Node|null
  54. * @since 29.0.0
  55. */
  56. public function getFirstNodeByIdInPath(int $id, string $path): ?Node;
  57. /**
  58. * @return IMountPoint[]
  59. *
  60. * @since 28.0.0
  61. */
  62. public function getMountsIn(string $mountPoint): array;
  63. /**
  64. * Create a `Node` for a file or folder from the cache entry and mountpoint
  65. *
  66. * @param ICacheEntry $cacheEntry
  67. * @param IMountPoint $mountPoint
  68. * @return Node
  69. * @since 28.0.0
  70. */
  71. public function getNodeFromCacheEntryAndMount(ICacheEntry $cacheEntry, IMountPoint $mountPoint): INode;
  72. /**
  73. * @since 28.0.0
  74. */
  75. public function getMount(string $mountPoint): IMountPoint;
  76. /**
  77. * @return string
  78. * @since 30.0.0
  79. */
  80. public function getAppDataDirectoryName(): string;
  81. }