1
0

IManager.php 3.2 KB

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