diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-10-22 11:25:33 +0200 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2020-10-23 12:25:31 +0200 |
commit | 86e5e7d9274241b0373bfa494896534b251e1978 (patch) | |
tree | 93bf7a5cee299889b8143304537265b1a5553b33 /apps/user_ldap/lib/Command | |
parent | 872f03209cccd376c0be908581164f245e558070 (diff) | |
download | nextcloud-server-86e5e7d9274241b0373bfa494896534b251e1978.tar.gz nextcloud-server-86e5e7d9274241b0373bfa494896534b251e1978.zip |
LDAP simplify User_Proxy and Group_Proxy signatures
- make User_Proxy and Group_Proxy easy to instantiate
- simplify dependent code
- move commands to info.xml
- make UpdateGroups job class non-static
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps/user_ldap/lib/Command')
-rw-r--r-- | apps/user_ldap/lib/Command/Search.php | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/apps/user_ldap/lib/Command/Search.php b/apps/user_ldap/lib/Command/Search.php index 5086f3a0c1a..2ee83e0f22b 100644 --- a/apps/user_ldap/lib/Command/Search.php +++ b/apps/user_ldap/lib/Command/Search.php @@ -29,11 +29,9 @@ namespace OCA\User_LDAP\Command; use OCA\User_LDAP\Group_Proxy; -use OCA\User_LDAP\GroupPluginManager; use OCA\User_LDAP\Helper; use OCA\User_LDAP\LDAP; use OCA\User_LDAP\User_Proxy; -use OCA\User_LDAP\UserPluginManager; use OCP\IConfig; use Symfony\Component\Console\Command\Command; @@ -45,13 +43,16 @@ use Symfony\Component\Console\Output\OutputInterface; class Search extends Command { /** @var \OCP\IConfig */ protected $ocConfig; + /** @var User_Proxy */ + private $userProxy; + /** @var Group_Proxy */ + private $groupProxy; - /** - * @param \OCP\IConfig $ocConfig - */ - public function __construct(IConfig $ocConfig) { - $this->ocConfig = $ocConfig; + public function __construct(IConfig $ocConfig, User_Proxy $userProxy, Group_Proxy $groupProxy) { parent::__construct(); + $this->ocConfig = $ocConfig; + $this->userProxy = $userProxy; + $this->groupProxy = $groupProxy; } protected function configure() { @@ -117,7 +118,7 @@ class Search extends Command { $this->validateOffsetAndLimit($offset, $limit); if ($input->getOption('group')) { - $proxy = new Group_Proxy($configPrefixes, $ldapWrapper, \OC::$server->query(GroupPluginManager::class)); + $proxy = $this->groupProxy; $getMethod = 'getGroups'; $printID = false; // convert the limit of groups to null. This will show all the groups available instead of @@ -126,14 +127,7 @@ class Search extends Command { $limit = null; } } else { - $proxy = new User_Proxy( - $configPrefixes, - $ldapWrapper, - $this->ocConfig, - \OC::$server->getNotificationManager(), - \OC::$server->getUserSession(), - \OC::$server->query(UserPluginManager::class) - ); + $proxy = $this->userProxy; $getMethod = 'getDisplayNames'; $printID = true; } |