systemtagsrelationscollection.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <?php
  2. /**
  3. * @author Thomas Müller <thomas.mueller@tmit.eu>
  4. * @author Vincent Petry <pvince81@owncloud.com>
  5. *
  6. * @copyright Copyright (c) 2016, ownCloud, Inc.
  7. * @license AGPL-3.0
  8. *
  9. * This code is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License, version 3,
  11. * as published by the Free Software Foundation.
  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, version 3,
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>
  20. *
  21. */
  22. namespace OCA\DAV\SystemTag;
  23. use OCP\SystemTag\ISystemTagManager;
  24. use OCP\SystemTag\ISystemTagObjectMapper;
  25. use Sabre\DAV\Exception\Forbidden;
  26. use Sabre\DAV\SimpleCollection;
  27. use OCP\IUserSession;
  28. use OCP\IGroupManager;
  29. use OCP\Files\IRootFolder;
  30. class SystemTagsRelationsCollection extends SimpleCollection {
  31. /**
  32. * SystemTagsRelationsCollection constructor.
  33. *
  34. * @param ISystemTagManager $tagManager
  35. * @param ISystemTagObjectMapper $tagMapper
  36. * @param IUserSession $userSession
  37. * @param IGroupManager $groupManager
  38. * @param IRootFolder $fileRoot
  39. */
  40. public function __construct(
  41. ISystemTagManager $tagManager,
  42. ISystemTagObjectMapper $tagMapper,
  43. IUserSession $userSession,
  44. IGroupManager $groupManager,
  45. IRootFolder $fileRoot
  46. ) {
  47. $children = [
  48. new SystemTagsObjectTypeCollection(
  49. 'files',
  50. $tagManager,
  51. $tagMapper,
  52. $userSession,
  53. $groupManager,
  54. $fileRoot
  55. ),
  56. ];
  57. parent::__construct('root', $children);
  58. }
  59. function getName() {
  60. return 'systemtags-relations';
  61. }
  62. function setName($name) {
  63. throw new Forbidden('Permission denied to rename this collection');
  64. }
  65. }