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.

imanager.php 5.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  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 OCP\IUser;
  23. use OC\Share20\Exception\ShareNotFound;
  24. /**
  25. * Interface IManager
  26. *
  27. * @package OCP\Share
  28. * @since 9.0.0
  29. */
  30. interface IManager {
  31. /**
  32. * Create a Share
  33. *
  34. * @param IShare $share
  35. * @return IShare The share object
  36. * @since 9.0.0
  37. */
  38. public function createShare(IShare $share);
  39. /**
  40. * Update a share.
  41. * The target of the share can't be changed this way: use moveShare
  42. * The share can't be removed this way (permission 0): use deleteShare
  43. *
  44. * @param IShare $share
  45. * @return IShare The share object
  46. * @since 9.0.0
  47. */
  48. public function updateShare(IShare $share);
  49. /**
  50. * Delete a share
  51. *
  52. * @param IShare $share
  53. * @throws ShareNotFound
  54. * @since 9.0.0
  55. */
  56. public function deleteShare(IShare $share);
  57. /**
  58. * Unshare a file as the recipient.
  59. * This can be different from a regular delete for example when one of
  60. * the users in a groups deletes that share. But the provider should
  61. * handle this.
  62. *
  63. * @param IShare $share
  64. * @param IUser $recipient
  65. * @since 9.0.0
  66. */
  67. public function deleteFromSelf(IShare $share, IUser $recipient);
  68. /**
  69. * Move the share as a recipient of the share.
  70. * This is updating the share target. So where the recipient has the share mounted.
  71. *
  72. * @param IShare $share
  73. * @param IUser $recipient
  74. * @return IShare
  75. * @throws \InvalidArgumentException If $share is a link share or the $recipient does not match
  76. * @since 9.0.0
  77. */
  78. public function moveShare(IShare $share, IUser $recipient);
  79. /**
  80. * Get shares shared by (initiated) by the provided user.
  81. *
  82. * @param IUser $user
  83. * @param int $shareType
  84. * @param \OCP\Files\File|\OCP\Files\Folder $path
  85. * @param bool $reshares
  86. * @param int $limit The maximum number of returned results, -1 for all results
  87. * @param int $offset
  88. * @return IShare[]
  89. * @since 9.0.0
  90. */
  91. public function getSharesBy(IUser $user, $shareType, $path = null, $reshares = false, $limit = 50, $offset = 0);
  92. /**
  93. * Get shares shared with $user.
  94. * Filter by $node if provided
  95. *
  96. * @param IUser $user
  97. * @param int $shareType
  98. * @param File|Folder|null $node
  99. * @param int $limit The maximum number of shares returned, -1 for all
  100. * @param int $offset
  101. * @return IShare[]
  102. * @since 9.0.0
  103. */
  104. public function getSharedWith(IUser $user, $shareType, $node = null, $limit = 50, $offset = 0);
  105. /**
  106. * Retrieve a share by the share id.
  107. * If the recipient is set make sure to retrieve the file for that user.
  108. * This makes sure that if a user has moved/deleted a group share this
  109. * is reflected.
  110. *
  111. * @param string $id
  112. * @param IUser|null $recipient
  113. * @return IShare
  114. * @throws ShareNotFound
  115. * @since 9.0.0
  116. */
  117. public function getShareById($id, $recipient = null);
  118. /**
  119. * Get the share by token possible with password
  120. *
  121. * @param string $token
  122. * @return IShare
  123. * @throws ShareNotFound
  124. * @since 9.0.0
  125. */
  126. public function getShareByToken($token);
  127. /**
  128. * Verify the password of a public share
  129. *
  130. * @param IShare $share
  131. * @param string $password
  132. * @return bool
  133. * @since 9.0.0
  134. */
  135. public function checkPassword(IShare $share, $password);
  136. /**
  137. * Instantiates a new share object. This is to be passed to
  138. * createShare.
  139. *
  140. * @return IShare
  141. * @since 9.0.0
  142. */
  143. public function newShare();
  144. /**
  145. * Is the share API enabled
  146. *
  147. * @return bool
  148. * @since 9.0.0
  149. */
  150. public function shareApiEnabled();
  151. /**
  152. * Is public link sharing enabled
  153. *
  154. * @return bool
  155. * @since 9.0.0
  156. */
  157. public function shareApiAllowLinks();
  158. /**
  159. * Is password on public link requires
  160. *
  161. * @return bool
  162. * @since 9.0.0
  163. */
  164. public function shareApiLinkEnforcePassword();
  165. /**
  166. * Is default expire date enabled
  167. *
  168. * @return bool
  169. * @since 9.0.0
  170. */
  171. public function shareApiLinkDefaultExpireDate();
  172. /**
  173. * Is default expire date enforced
  174. *`
  175. * @return bool
  176. * @since 9.0.0
  177. */
  178. public function shareApiLinkDefaultExpireDateEnforced();
  179. /**
  180. * Number of default expire days
  181. *
  182. * @return int
  183. * @since 9.0.0
  184. */
  185. public function shareApiLinkDefaultExpireDays();
  186. /**
  187. * Allow public upload on link shares
  188. *
  189. * @return bool
  190. * @since 9.0.0
  191. */
  192. public function shareApiLinkAllowPublicUpload();
  193. /**
  194. * check if user can only share with group members
  195. * @return bool
  196. * @since 9.0.0
  197. */
  198. public function shareWithGroupMembersOnly();
  199. /**
  200. * Check if sharing is disabled for the given user
  201. *
  202. * @param IUser $user
  203. * @return bool
  204. * @since 9.0.0
  205. */
  206. public function sharingDisabledForUser(IUser $user);
  207. }