1 | <?php |
||
89 | class ShareByCircleProvider implements IShareProvider { |
||
90 | |||
91 | |||
92 | use TArrayTools; |
||
93 | use TStringTools; |
||
94 | |||
95 | |||
96 | const IDENTIFIER = 'ocCircleShare'; |
||
97 | |||
98 | |||
99 | /** @var IUserManager */ |
||
100 | private $userManager; |
||
101 | |||
102 | /** @var IRootFolder */ |
||
103 | private $rootFolder; |
||
104 | |||
105 | /** @var IL10N */ |
||
106 | private $l10n; |
||
107 | |||
108 | /** @var ILogger */ |
||
109 | private $logger; |
||
110 | |||
111 | /** @var IURLGenerator */ |
||
112 | private $urlGenerator; |
||
113 | |||
114 | |||
115 | /** @var ShareWrapperService */ |
||
116 | private $shareWrapperService; |
||
117 | |||
118 | /** @var FederatedUserService */ |
||
119 | private $federatedUserService; |
||
120 | |||
121 | /** @var FederatedEventService */ |
||
122 | private $federatedEventService; |
||
123 | |||
124 | /** @var CircleService */ |
||
125 | private $circleService; |
||
126 | |||
127 | /** @var EventService */ |
||
128 | private $eventService; |
||
129 | |||
130 | |||
131 | /** |
||
132 | * ShareByCircleProvider constructor. |
||
133 | * |
||
134 | * @param IDBConnection $connection |
||
135 | * @param ISecureRandom $secureRandom |
||
136 | * @param IUserManager $userManager |
||
137 | * @param IRootFolder $rootFolder |
||
138 | * @param IL10N $l10n |
||
139 | * @param ILogger $logger |
||
140 | * @param IURLGenerator $urlGenerator |
||
141 | */ |
||
142 | public function __construct( |
||
158 | |||
159 | |||
160 | /** |
||
161 | * @return string |
||
162 | */ |
||
163 | public function identifier(): string { |
||
166 | |||
167 | |||
168 | /** |
||
169 | * @param IShare $share |
||
170 | * |
||
171 | * @return IShare |
||
172 | * @throws AlreadySharedException |
||
173 | * @throws CircleNotFoundException |
||
174 | * @throws FederatedEventException |
||
175 | * @throws FederatedItemException |
||
176 | * @throws InitiatorNotConfirmedException |
||
177 | * @throws OwnerNotFoundException |
||
178 | * @throws RemoteInstanceException |
||
179 | * @throws RemoteNotFoundException |
||
180 | * @throws RemoteResourceNotFoundException |
||
181 | * @throws UnknownRemoteException |
||
182 | * @throws FederatedUserException |
||
183 | * @throws FederatedUserNotFoundException |
||
184 | * @throws IllegalIDChangeException |
||
185 | * @throws InitiatorNotFoundException |
||
186 | * @throws InvalidIdException |
||
187 | * @throws InvalidPathException |
||
188 | * @throws NotFoundException |
||
189 | * @throws RequestBuilderException |
||
190 | * @throws ShareNotFound |
||
191 | * @throws SingleCircleNotFoundException |
||
192 | */ |
||
193 | public function create(IShare $share): IShare { |
||
244 | |||
245 | |||
246 | /** |
||
247 | * @param IShare $share |
||
248 | * |
||
249 | * @return IShare |
||
250 | */ |
||
251 | public function update(IShare $share): IShare { |
||
256 | |||
257 | /** |
||
258 | * @param IShare $share |
||
259 | */ |
||
260 | public function delete(IShare $share): void { |
||
263 | |||
264 | /** |
||
265 | * @param IShare $share |
||
266 | * @param string $recipient |
||
267 | */ |
||
268 | public function deleteFromSelf(IShare $share, $recipient): void { |
||
271 | |||
272 | /** |
||
273 | * @param IShare $share |
||
274 | * @param string $recipient |
||
275 | * |
||
276 | * @return IShare |
||
277 | */ |
||
278 | public function restore(IShare $share, string $recipient): IShare { |
||
283 | |||
284 | /** |
||
285 | * @param IShare $share |
||
286 | * @param string $recipient |
||
287 | * |
||
288 | * @return IShare |
||
289 | * @throws FederatedUserException |
||
290 | * @throws FederatedUserNotFoundException |
||
291 | * @throws InvalidIdException |
||
292 | * @throws ShareWrapperNotFoundException |
||
293 | * @throws SingleCircleNotFoundException |
||
294 | * @throws IllegalIDChangeException |
||
295 | * @throws NotFoundException |
||
296 | * @throws RequestBuilderException |
||
297 | */ |
||
298 | public function move(IShare $share, $recipient): IShare { |
||
312 | |||
313 | |||
314 | /** |
||
315 | * @param string $userId |
||
316 | * @param Folder $node |
||
317 | * @param bool $reshares |
||
318 | * |
||
319 | * @return array |
||
320 | * @throws FederatedUserException |
||
321 | * @throws FederatedUserNotFoundException |
||
322 | * @throws IllegalIDChangeException |
||
323 | * @throws InvalidIdException |
||
324 | * @throws InvalidPathException |
||
325 | * @throws NotFoundException |
||
326 | * @throws SingleCircleNotFoundException |
||
327 | * @throws RequestBuilderException |
||
328 | */ |
||
329 | public function getSharesInFolder($userId, Folder $node, $reshares): array { |
||
352 | |||
353 | |||
354 | /** |
||
355 | * @param string $userId |
||
356 | * @param int $shareType |
||
357 | * @param Node|null $node |
||
358 | * @param bool $reshares |
||
359 | * @param int $limit |
||
360 | * @param int $offset |
||
361 | * |
||
362 | * @return IShare[] |
||
363 | * @throws FederatedUserException |
||
364 | * @throws FederatedUserNotFoundException |
||
365 | * @throws IllegalIDChangeException |
||
366 | * @throws InvalidIdException |
||
367 | * @throws InvalidPathException |
||
368 | * @throws NotFoundException |
||
369 | * @throws RequestBuilderException |
||
370 | * @throws SingleCircleNotFoundException |
||
371 | */ |
||
372 | public function getSharesBy($userId, $shareType, $node, $reshares, $limit, $offset): array { |
||
397 | |||
398 | |||
399 | /** |
||
400 | * @param string $shareId |
||
401 | * @param string|null $recipientId |
||
402 | * |
||
403 | * @return IShare |
||
404 | * @throws FederatedUserException |
||
405 | * @throws FederatedUserNotFoundException |
||
406 | * @throws IllegalIDChangeException |
||
407 | * @throws InvalidIdException |
||
408 | * @throws ShareNotFound |
||
409 | * @throws SingleCircleNotFoundException |
||
410 | */ |
||
411 | public function getShareById($shareId, $recipientId = null): IShare { |
||
428 | |||
429 | |||
430 | /** |
||
431 | * @param Node $path |
||
432 | * |
||
433 | * @return IShare[] |
||
434 | * @throws InvalidPathException |
||
435 | * @throws NotFoundException |
||
436 | * @throws IllegalIDChangeException |
||
437 | */ |
||
438 | public function getSharesByPath(Node $path): array { |
||
450 | |||
451 | |||
452 | /** |
||
453 | * @param string $userId |
||
454 | * @param int $shareType |
||
455 | * @param Node|null $node |
||
456 | * @param int $limit |
||
457 | * @param int $offset |
||
458 | * |
||
459 | * @return IShare[] |
||
460 | * @throws FederatedUserException |
||
461 | * @throws FederatedUserNotFoundException |
||
462 | * @throws IllegalIDChangeException |
||
463 | * @throws InvalidIdException |
||
464 | * @throws InvalidPathException |
||
465 | * @throws NotFoundException |
||
466 | * @throws RequestBuilderException |
||
467 | * @throws SingleCircleNotFoundException |
||
468 | */ |
||
469 | public function getSharedWith($userId, $shareType, $node, $limit, $offset): array { |
||
490 | |||
491 | |||
492 | /** |
||
493 | * @param string $token |
||
494 | * |
||
495 | * @return IShare |
||
496 | */ |
||
497 | public function getShareByToken($token): IShare { |
||
500 | |||
501 | |||
502 | /** |
||
503 | * @param string $uid |
||
504 | * @param int $shareType |
||
505 | */ |
||
506 | public function userDeleted($uid, $shareType): void { |
||
509 | |||
510 | |||
511 | /** |
||
512 | * @param string $gid |
||
513 | */ |
||
514 | public function groupDeleted($gid): void { |
||
517 | |||
518 | |||
519 | /** |
||
520 | * @param string $uid |
||
521 | * @param string $gid |
||
522 | */ |
||
523 | public function userDeletedFromGroup($uid, $gid): void { |
||
526 | |||
527 | |||
528 | /** |
||
529 | * @param Node[] $nodes |
||
530 | * @param bool $currentAccess |
||
531 | * |
||
532 | * @return array |
||
533 | */ |
||
534 | public function getAccessList($nodes, $currentAccess): array { |
||
539 | |||
540 | |||
541 | /** |
||
542 | * @return iterable |
||
543 | */ |
||
544 | public function getAllShares(): iterable { |
||
568 | |||
569 | } |
||
570 | |||
571 |