1
0

IManager.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Collaboration\Resources;
  8. use OCP\IUser;
  9. /**
  10. * @since 16.0.0
  11. */
  12. interface IManager extends IProvider {
  13. /**
  14. * @param int $id
  15. * @return ICollection
  16. * @throws CollectionException when the collection could not be found
  17. * @since 16.0.0
  18. */
  19. public function getCollection(int $id): ICollection;
  20. /**
  21. * @param int $id
  22. * @param IUser|null $user
  23. * @return ICollection
  24. * @throws CollectionException when the collection could not be found
  25. * @since 16.0.0
  26. */
  27. public function getCollectionForUser(int $id, ?IUser $user): ICollection;
  28. /**
  29. * @param string $name
  30. * @return ICollection
  31. * @since 16.0.0
  32. */
  33. public function newCollection(string $name): ICollection;
  34. /**
  35. * Can a user/guest access the collection
  36. *
  37. * @param ICollection $collection
  38. * @param IUser|null $user
  39. * @return bool
  40. * @since 16.0.0
  41. */
  42. public function canAccessCollection(ICollection $collection, ?IUser $user): bool;
  43. /**
  44. * @param IUser|null $user
  45. * @since 16.0.0
  46. */
  47. public function invalidateAccessCacheForUser(?IUser $user): void;
  48. /**
  49. * @param IResource $resource
  50. * @since 16.0.0
  51. */
  52. public function invalidateAccessCacheForResource(IResource $resource): void;
  53. /**
  54. * @param IResource $resource
  55. * @param IUser|null $user
  56. * @since 16.0.0
  57. */
  58. public function invalidateAccessCacheForResourceByUser(IResource $resource, ?IUser $user): void;
  59. /**
  60. * @param IProvider $provider
  61. * @since 16.0.0
  62. */
  63. public function invalidateAccessCacheForProvider(IProvider $provider): void;
  64. /**
  65. * @param IProvider $provider
  66. * @param IUser|null $user
  67. * @since 16.0.0
  68. */
  69. public function invalidateAccessCacheForProviderByUser(IProvider $provider, ?IUser $user): void;
  70. /**
  71. * @param string $type
  72. * @param string $id
  73. * @return IResource
  74. * @since 16.0.0
  75. */
  76. public function createResource(string $type, string $id): IResource;
  77. /**
  78. * @param string $type
  79. * @param string $id
  80. * @param IUser|null $user
  81. * @return IResource
  82. * @throws ResourceException
  83. * @since 16.0.0
  84. */
  85. public function getResourceForUser(string $type, string $id, ?IUser $user): IResource;
  86. /**
  87. * @param string $provider
  88. * @since 16.0.0
  89. * @deprecated 18.0.0 Use IProviderManager::registerResourceProvider instead
  90. */
  91. public function registerResourceProvider(string $provider): void;
  92. }