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.

share_backend.php 2.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * ownCloud
  4. *
  5. * @author Bjoern Schiessle, Michael Gapczynski
  6. * @copyright 2012 Michael Gapczynski <mtgap@owncloud.com>
  7. * 2014 Bjoern Schiessle <schiessle@owncloud.com>
  8. *
  9. * This file is licensed under the Affero General Public License version 3 or
  10. * later.
  11. * See the COPYING-README file.
  12. */
  13. // use OCP namespace for all classes that are considered public.
  14. // This means that they should be used by apps instead of the internal ownCloud classes
  15. namespace OCP;
  16. /**
  17. * Interface that apps must implement to share content.
  18. */
  19. interface Share_Backend {
  20. /**
  21. * Check if this $itemSource exist for the user
  22. * @param string $itemSource
  23. * @param string $uidOwner Owner of the item
  24. * @return boolean|null Source
  25. *
  26. * Return false if the item does not exist for the user
  27. */
  28. public function isValidSource($itemSource, $uidOwner);
  29. /**
  30. * Get a unique name of the item for the specified user
  31. * @param string $itemSource
  32. * @param string|false $shareWith User the item is being shared with
  33. * @param array|null $exclude List of similar item names already existing as shared items @deprecated since version OC7
  34. * @return string Target name
  35. *
  36. * This function needs to verify that the user does not already have an item with this name.
  37. * If it does generate a new name e.g. name_#
  38. */
  39. public function generateTarget($itemSource, $shareWith, $exclude = null);
  40. /**
  41. * Converts the shared item sources back into the item in the specified format
  42. * @param array $items Shared items
  43. * @param int $format
  44. * @return TODO
  45. *
  46. * The items array is a 3-dimensional array with the item_source as the
  47. * first key and the share id as the second key to an array with the share
  48. * info.
  49. *
  50. * The key/value pairs included in the share info depend on the function originally called:
  51. * If called by getItem(s)Shared: id, item_type, item, item_source,
  52. * share_type, share_with, permissions, stime, file_source
  53. *
  54. * If called by getItem(s)SharedWith: id, item_type, item, item_source,
  55. * item_target, share_type, share_with, permissions, stime, file_source,
  56. * file_target
  57. *
  58. * This function allows the backend to control the output of shared items with custom formats.
  59. * It is only called through calls to the public getItem(s)Shared(With) functions.
  60. */
  61. public function formatItems($items, $format, $parameters = null);
  62. }