IDocumentAccess.php 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2019 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\FullTextSearch\Model;
  8. /**
  9. * Interface IDocumentAccess
  10. *
  11. * This object is used as a data transfer object when
  12. *
  13. * - indexing a document,
  14. * - generating a search request.
  15. *
  16. * During the index, it is used to define which users, groups, circles, ...
  17. * have access to the IIndexDocument
  18. *
  19. * During the search, it is internally use to define to which group, circles, ...
  20. * a user that perform the search belongs to.
  21. *
  22. * @see IIndexDocument::setAccess
  23. *
  24. * @since 16.0.0
  25. *
  26. */
  27. interface IDocumentAccess {
  28. /**
  29. * Owner of the document can be set at the init of the object.
  30. *
  31. * @since 16.0.0
  32. *
  33. * IDocumentAccess constructor.
  34. *
  35. * @param string $ownerId
  36. */
  37. public function __construct(string $ownerId = '');
  38. /**
  39. * Set the Owner of the document.
  40. *
  41. * @since 16.0.0
  42. *
  43. * @param string $ownerId
  44. *
  45. * @return IDocumentAccess
  46. */
  47. public function setOwnerId(string $ownerId): IDocumentAccess;
  48. /**
  49. * Get the Owner of the document.
  50. *
  51. * @since 16.0.0
  52. *
  53. * @return string
  54. */
  55. public function getOwnerId(): string;
  56. /**
  57. * Set the viewer of the document.
  58. *
  59. * @since 16.0.0
  60. *
  61. * @param string $viewerId
  62. *
  63. * @return IDocumentAccess
  64. */
  65. public function setViewerId(string $viewerId): IDocumentAccess;
  66. /**
  67. * Get the viewer of the document.
  68. *
  69. * @since 16.0.0
  70. *
  71. * @return string
  72. */
  73. public function getViewerId(): string;
  74. /**
  75. * Set the list of users that have read access to the document.
  76. *
  77. * @since 16.0.0
  78. *
  79. * @param array $users
  80. *
  81. * @return IDocumentAccess
  82. */
  83. public function setUsers(array $users): IDocumentAccess;
  84. /**
  85. * Add an entry to the list of users that have read access to the document.
  86. *
  87. * @since 16.0.0
  88. *
  89. * @param string $user
  90. *
  91. * @return IDocumentAccess
  92. */
  93. public function addUser(string $user): IDocumentAccess;
  94. /**
  95. * Add multiple entries to the list of users that have read access to the
  96. * document.
  97. *
  98. * @since 16.0.0
  99. *
  100. * @param array $users
  101. *
  102. * @return IDocumentAccess
  103. */
  104. public function addUsers($users): IDocumentAccess;
  105. /**
  106. * Get the complete list of users that have read access to the document.
  107. *
  108. * @since 16.0.0
  109. *
  110. * @return array
  111. */
  112. public function getUsers(): array;
  113. /**
  114. * Set the list of groups that have read access to the document.
  115. *
  116. * @since 16.0.0
  117. *
  118. * @param array $groups
  119. *
  120. * @return IDocumentAccess
  121. */
  122. public function setGroups(array $groups): IDocumentAccess;
  123. /**
  124. * Add an entry to the list of groups that have read access to the document.
  125. *
  126. * @since 16.0.0
  127. *
  128. * @param string $group
  129. *
  130. * @return IDocumentAccess
  131. */
  132. public function addGroup(string $group): IDocumentAccess;
  133. /**
  134. * Add multiple entries to the list of groups that have read access to the
  135. * document.
  136. *
  137. * @since 16.0.0
  138. *
  139. * @param array $groups
  140. *
  141. * @return IDocumentAccess
  142. */
  143. public function addGroups(array $groups);
  144. /**
  145. * Get the complete list of groups that have read access to the document.
  146. *
  147. * @since 16.0.0
  148. *
  149. * @return array
  150. */
  151. public function getGroups(): array;
  152. /**
  153. * Set the list of circles that have read access to the document.
  154. *
  155. * @since 16.0.0
  156. *
  157. * @param array $circles
  158. *
  159. * @return IDocumentAccess
  160. */
  161. public function setCircles(array $circles): IDocumentAccess;
  162. /**
  163. * Add an entry to the list of circles that have read access to the document.
  164. *
  165. * @since 16.0.0
  166. *
  167. * @param string $circle
  168. *
  169. * @return IDocumentAccess
  170. */
  171. public function addCircle(string $circle): IDocumentAccess;
  172. /**
  173. * Add multiple entries to the list of groups that have read access to the
  174. * document.
  175. *
  176. * @since 16.0.0
  177. *
  178. * @param array $circles
  179. *
  180. * @return IDocumentAccess
  181. */
  182. public function addCircles(array $circles): IDocumentAccess;
  183. /**
  184. * Get the complete list of circles that have read access to the document.
  185. *
  186. * @since 16.0.0
  187. *
  188. * @return array
  189. */
  190. public function getCircles(): array;
  191. /**
  192. * Set the list of links that have read access to the document.
  193. *
  194. * @since 16.0.0
  195. *
  196. * @param array $links
  197. *
  198. * @return IDocumentAccess
  199. */
  200. public function setLinks(array $links): IDocumentAccess;
  201. /**
  202. * Get the list of links that have read access to the document.
  203. *
  204. * @since 16.0.0
  205. *
  206. * @return array
  207. */
  208. public function getLinks(): array;
  209. }