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.

ishareprovider.php 3.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. <?php
  2. /**
  3. * @author Roeland Jago Douma <rullzer@owncloud.com>
  4. *
  5. * @copyright Copyright (c) 2016, ownCloud, Inc.
  6. * @license AGPL-3.0
  7. *
  8. * This code is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License, version 3,
  10. * as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU Affero General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU Affero General Public License, version 3,
  18. * along with this program. If not, see <http://www.gnu.org/licenses/>
  19. *
  20. */
  21. namespace OCP\Share;
  22. use OC\Share20\Exception\ShareNotFound;
  23. use OC\Share20\Exception\BackendError;
  24. use OCP\Files\Node;
  25. use OCP\IUser;
  26. /**
  27. * Interface IShareProvider
  28. *
  29. * @package OCP\Share
  30. * @since 9.0.0
  31. */
  32. interface IShareProvider {
  33. /**
  34. * Return the identifier of this provider.
  35. *
  36. * @return string Containing only [a-zA-Z0-9]
  37. * @since 9.0.0
  38. */
  39. public function identifier();
  40. /**
  41. * Create a share
  42. *
  43. * @param \OCP\Share\IShare $share
  44. * @return \OCP\Share\IShare The share object
  45. * @since 9.0.0
  46. */
  47. public function create(\OCP\Share\IShare $share);
  48. /**
  49. * Update a share
  50. *
  51. * @param \OCP\Share\IShare $share
  52. * @return \OCP\Share\IShare The share object
  53. * @since 9.0.0
  54. */
  55. public function update(\OCP\Share\IShare $share);
  56. /**
  57. * Delete a share
  58. *
  59. * @param \OCP\Share\IShare $share
  60. * @since 9.0.0
  61. */
  62. public function delete(\OCP\Share\IShare $share);
  63. /**
  64. * Unshare a file from self as recipient.
  65. * This may require special handling. If a user unshares a group
  66. * share from their self then the original group share should still exist.
  67. *
  68. * @param \OCP\Share\IShare $share
  69. * @param IUser $recipient
  70. * @since 9.0.0
  71. */
  72. public function deleteFromSelf(\OCP\Share\IShare $share, IUser $recipient);
  73. /**
  74. * Move a share as a recipient.
  75. * This is updating the share target. Thus the mount point of the recipient.
  76. * This may require special handling. If a user moves a group share
  77. * the target should only be changed for them.
  78. *
  79. * @param \OCP\Share\IShare $share
  80. * @param IUser $recipient
  81. * @return \OCP\Share\IShare
  82. * @since 9.0.0
  83. */
  84. public function move(\OCP\Share\IShare $share, IUser $recipient);
  85. /**
  86. * Get all shares by the given user
  87. *
  88. * @param IUser $user
  89. * @param int $shareType
  90. * @param \OCP\Files\File|\OCP\Files\Folder $node
  91. * @param bool $reshares Also get the shares where $user is the owner instead of just the shares where $user is the initiator
  92. * @param int $limit The maximum number of shares to be returned, -1 for all shares
  93. * @param int $offset
  94. * @return \OCP\Share\I Share[]
  95. * @since 9.0.0
  96. */
  97. public function getSharesBy(IUser $user, $shareType, $node, $reshares, $limit, $offset);
  98. /**
  99. * Get share by id
  100. *
  101. * @param int $id
  102. * @param IUser|null $recipient
  103. * @return \OCP\Share\IShare
  104. * @throws ShareNotFound
  105. * @since 9.0.0
  106. */
  107. public function getShareById($id, $recipient = null);
  108. /**
  109. * Get shares for a given path
  110. *
  111. * @param \OCP\Files\Node $path
  112. * @return \OCP\Share\IShare[]
  113. * @since 9.0.0
  114. */
  115. public function getSharesByPath(\OCP\Files\Node $path);
  116. /**
  117. * Get shared with the given user
  118. *
  119. * @param IUser $user get shares where this user is the recipient
  120. * @param int $shareType
  121. * @param Node|null $node
  122. * @param int $limit The max number of entries returned, -1 for all
  123. * @param int $offset
  124. * @return \OCP\Share\IShare[]
  125. * @since 9.0.0
  126. */
  127. public function getSharedWith(IUser $user, $shareType, $node, $limit, $offset);
  128. /**
  129. * Get a share by token
  130. *
  131. * @param string $token
  132. * @return \OCP\Share\IShare
  133. * @throws ShareNotFound
  134. * @since 9.0.0
  135. */
  136. public function getShareByToken($token);
  137. }