AccessFactory.php 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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\IAppConfig;
  9. use OCP\IConfig;
  10. use OCP\IUserManager;
  11. use OCP\Server;
  12. use Psr\Log\LoggerInterface;
  13. class AccessFactory {
  14. public function __construct(
  15. private ILDAPWrapper $ldap,
  16. private Helper $helper,
  17. private IConfig $config,
  18. private IAppConfig $appConfig,
  19. private IUserManager $ncUserManager,
  20. private LoggerInterface $logger,
  21. ) {
  22. $this->ldap = $ldap;
  23. $this->helper = $helper;
  24. $this->config = $config;
  25. $this->ncUserManager = $ncUserManager;
  26. $this->logger = $logger;
  27. }
  28. public function get(Connection $connection): Access {
  29. /* Each Access instance gets its own Manager instance, see OCA\User_LDAP\AppInfo\Application::register() */
  30. return new Access(
  31. $this->ldap,
  32. $connection,
  33. Server::get(Manager::class),
  34. $this->helper,
  35. $this->config,
  36. $this->ncUserManager,
  37. $this->logger,
  38. $this->appConfig,
  39. );
  40. }
  41. }