Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. //NOVA VERZE 14
  2. public function updateShare(
  3. string $id,
  4. int $permissions = null,
  5. string $password = null,
  6. string $sendPasswordByTalk = null,
  7. string $publicUpload = null,
  8. string $expireDate = null,
  9. string $note = null,
  10. string $label = null,
  11. string $hideDownload = null
  12. ): DataResponse {
  13. try {
  14. $share = $this->getShareById($id);
  15. } catch (ShareNotFound $e) {
  16. throw new OCSNotFoundException($this->l->t('Wrong share ID, share doesn\'t exist'));
  17. }
  18. $this->lock($share->getNode());
  19. if (!$this->canAccessShare($share, false)) {
  20. throw new OCSNotFoundException($this->l->t('Wrong share ID, share doesn\'t exist'));
  21. }
  22. if ($share->getShareOwner() !== $this->currentUser && $share->getSharedBy() !== $this->currentUser) {
  23. throw new OCSForbiddenException('You are not allowed to edit incoming shares');
  24. }
  25. if ($permissions === null &&
  26. $password === null &&
  27. $sendPasswordByTalk === null &&
  28. $publicUpload === null &&
  29. $expireDate === null &&
  30. $note === null &&
  31. $label === null &&
  32. $hideDownload === null
  33. ) {
  34. throw new OCSBadRequestException($this->l->t('Wrong or no update parameter given'));
  35. }
  36. if($note !== null) {
  37. $share->setNote($note);
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement