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.

256 lines
5.1 KiB

3 years ago
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright 2018
  5. *
  6. * @author Maxence Lange <maxence@artificial-owl.com>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCP\FullTextSearch\Model;
  25. /**
  26. * Interface IDocumentAccess
  27. *
  28. * This object is used as a data transfer object when
  29. *
  30. * - indexing a document,
  31. * - generating a search request.
  32. *
  33. * During the index, it is used to define which users, groups, circles, ...
  34. * have access to the IIndexDocument
  35. *
  36. * During the search, it is internally use to define to which group, circles, ...
  37. * a user that perform the search belongs to.
  38. *
  39. * @see IIndexDocument::setAccess
  40. *
  41. * @since 16.0.0
  42. *
  43. */
  44. interface IDocumentAccess {
  45. /**
  46. * Owner of the document can be set at the init of the object.
  47. *
  48. * @since 16.0.0
  49. *
  50. * IDocumentAccess constructor.
  51. *
  52. * @param string $ownerId
  53. */
  54. public function __construct(string $ownerId = '');
  55. /**
  56. * Set the Owner of the document.
  57. *
  58. * @since 16.0.0
  59. *
  60. * @param string $ownerId
  61. *
  62. * @return IDocumentAccess
  63. */
  64. public function setOwnerId(string $ownerId): IDocumentAccess;
  65. /**
  66. * Get the Owner of the document.
  67. *
  68. * @since 16.0.0
  69. *
  70. * @return string
  71. */
  72. public function getOwnerId(): string;
  73. /**
  74. * Set the viewer of the document.
  75. *
  76. * @since 16.0.0
  77. *
  78. * @param string $viewerId
  79. *
  80. * @return IDocumentAccess
  81. */
  82. public function setViewerId(string $viewerId): IDocumentAccess;
  83. /**
  84. * Get the viewer of the document.
  85. *
  86. * @since 16.0.0
  87. *
  88. * @return string
  89. */
  90. public function getViewerId(): string;
  91. /**
  92. * Set the list of users that have read access to the document.
  93. *
  94. * @since 16.0.0
  95. *
  96. * @param array $users
  97. *
  98. * @return IDocumentAccess
  99. */
  100. public function setUsers(array $users): IDocumentAccess;
  101. /**
  102. * Add an entry to the list of users that have read access to the document.
  103. *
  104. * @since 16.0.0
  105. *
  106. * @param string $user
  107. *
  108. * @return IDocumentAccess
  109. */
  110. public function addUser(string $user): IDocumentAccess;
  111. /**
  112. * Add multiple entries to the list of users that have read access to the
  113. * document.
  114. *
  115. * @since 16.0.0
  116. *
  117. * @param array $users
  118. *
  119. * @return IDocumentAccess
  120. */
  121. public function addUsers($users): IDocumentAccess;
  122. /**
  123. * Get the complete list of users that have read access to the document.
  124. *
  125. * @since 16.0.0
  126. *
  127. * @return array
  128. */
  129. public function getUsers(): array;
  130. /**
  131. * Set the list of groups that have read access to the document.
  132. *
  133. * @since 16.0.0
  134. *
  135. * @param array $groups
  136. *
  137. * @return IDocumentAccess
  138. */
  139. public function setGroups(array $groups): IDocumentAccess;
  140. /**
  141. * Add an entry to the list of groups that have read access to the document.
  142. *
  143. * @since 16.0.0
  144. *
  145. * @param string $group
  146. *
  147. * @return IDocumentAccess
  148. */
  149. public function addGroup(string $group): IDocumentAccess;
  150. /**
  151. * Add multiple entries to the list of groups that have read access to the
  152. * document.
  153. *
  154. * @since 16.0.0
  155. *
  156. * @param array $groups
  157. *
  158. * @return IDocumentAccess
  159. */
  160. public function addGroups(array $groups);
  161. /**
  162. * Get the complete list of groups that have read access to the document.
  163. *
  164. * @since 16.0.0
  165. *
  166. * @return array
  167. */
  168. public function getGroups(): array;
  169. /**
  170. * Set the list of circles that have read access to the document.
  171. *
  172. * @since 16.0.0
  173. *
  174. * @param array $circles
  175. *
  176. * @return IDocumentAccess
  177. */
  178. public function setCircles(array $circles): IDocumentAccess;
  179. /**
  180. * Add an entry to the list of circles that have read access to the document.
  181. *
  182. * @since 16.0.0
  183. *
  184. * @param string $circle
  185. *
  186. * @return IDocumentAccess
  187. */
  188. public function addCircle(string $circle): IDocumentAccess;
  189. /**
  190. * Add multiple entries to the list of groups that have read access to the
  191. * document.
  192. *
  193. * @since 16.0.0
  194. *
  195. * @param array $circles
  196. *
  197. * @return IDocumentAccess
  198. */
  199. public function addCircles(array $circles): IDocumentAccess;
  200. /**
  201. * Get the complete list of circles that have read access to the document.
  202. *
  203. * @since 16.0.0
  204. *
  205. * @return array
  206. */
  207. public function getCircles(): array;
  208. /**
  209. * Set the list of links that have read access to the document.
  210. *
  211. * @since 16.0.0
  212. *
  213. * @param array $links
  214. *
  215. * @return IDocumentAccess
  216. */
  217. public function setLinks(array $links): IDocumentAccess;
  218. /**
  219. * Get the list of links that have read access to the document.
  220. *
  221. * @since 16.0.0
  222. *
  223. * @return array
  224. */
  225. public function getLinks(): array;
  226. }