AccessFactory.php 1013 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-License-Identifier: AGPL-3.0-or-later
  5. */
  6. namespace OCA\User_LDAP;
  7. use OCA\User_LDAP\User\Manager;
  8. use OCP\EventDispatcher\IEventDispatcher;
  9. use OCP\IAppConfig;
  10. use OCP\IConfig;
  11. use OCP\IUserManager;
  12. use OCP\Server;
  13. use Psr\Log\LoggerInterface;
  14. class AccessFactory {
  15. public function __construct(
  16. private ILDAPWrapper $ldap,
  17. private Helper $helper,
  18. private IConfig $config,
  19. private IAppConfig $appConfig,
  20. private IUserManager $ncUserManager,
  21. private LoggerInterface $logger,
  22. private IEventDispatcher $dispatcher,
  23. ) {
  24. }
  25. public function get(Connection $connection): Access {
  26. /* Each Access instance gets its own Manager instance, see OCA\User_LDAP\AppInfo\Application::register() */
  27. return new Access(
  28. $this->ldap,
  29. $connection,
  30. Server::get(Manager::class),
  31. $this->helper,
  32. $this->config,
  33. $this->ncUserManager,
  34. $this->logger,
  35. $this->appConfig,
  36. $this->dispatcher,
  37. );
  38. }
  39. }