IManager.php 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2018 Joas Schilling <coding@schilljs.com>
  5. *
  6. * @license GNU AGPL version 3 or any later version
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU Affero General Public License as
  10. * published by the Free Software Foundation, either version 3 of the
  11. * License, or (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Affero General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Affero General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. */
  22. namespace OCP\Collaboration\Resources;
  23. use OCP\IUser;
  24. /**
  25. * @since 16.0.0
  26. */
  27. interface IManager extends IProvider {
  28. /**
  29. * @param int $id
  30. * @return ICollection
  31. * @throws CollectionException when the collection could not be found
  32. * @since 16.0.0
  33. */
  34. public function getCollection(int $id): ICollection;
  35. /**
  36. * @param int $id
  37. * @param IUser|null $user
  38. * @return ICollection
  39. * @throws CollectionException when the collection could not be found
  40. * @since 16.0.0
  41. */
  42. public function getCollectionForUser(int $id, ?IUser $user): ICollection;
  43. /**
  44. * @param string $name
  45. * @return ICollection
  46. * @since 16.0.0
  47. */
  48. public function newCollection(string $name): ICollection;
  49. /**
  50. * Can a user/guest access the collection
  51. *
  52. * @param ICollection $collection
  53. * @param IUser|null $user
  54. * @return bool
  55. * @since 16.0.0
  56. */
  57. public function canAccessCollection(ICollection $collection, ?IUser $user): bool;
  58. /**
  59. * @param IUser|null $user
  60. * @since 16.0.0
  61. */
  62. public function invalidateAccessCacheForUser(?IUser $user): void;
  63. /**
  64. * @param IResource $resource
  65. * @since 16.0.0
  66. */
  67. public function invalidateAccessCacheForResource(IResource $resource): void;
  68. /**
  69. * @param IResource $resource
  70. * @param IUser|null $user
  71. * @since 16.0.0
  72. */
  73. public function invalidateAccessCacheForResourceByUser(IResource $resource, ?IUser $user): void;
  74. /**
  75. * @param IProvider $provider
  76. * @since 16.0.0
  77. */
  78. public function invalidateAccessCacheForProvider(IProvider $provider): void;
  79. /**
  80. * @param IProvider $provider
  81. * @param IUser|null $user
  82. * @since 16.0.0
  83. */
  84. public function invalidateAccessCacheForProviderByUser(IProvider $provider, ?IUser $user): void;
  85. /**
  86. * @param string $type
  87. * @param string $id
  88. * @return IResource
  89. * @since 16.0.0
  90. */
  91. public function createResource(string $type, string $id): IResource;
  92. /**
  93. * @param string $type
  94. * @param string $id
  95. * @param IUser|null $user
  96. * @return IResource
  97. * @throws ResourceException
  98. * @since 16.0.0
  99. */
  100. public function getResourceForUser(string $type, string $id, ?IUser $user): IResource;
  101. /**
  102. * @param string $provider
  103. * @since 16.0.0
  104. */
  105. public function registerResourceProvider(string $provider): void;
  106. }