createDetail('LDAP configuration', $this->getLDAPInfo(), IDetail::TYPE_COLLAPSIBLE_PREFORMAT); return parent::getDetails(); } public function isLDAPEnabled(): bool { $backends = $this->userManager->getBackends(); foreach ($backends as $backend) { if ($backend instanceof User_Proxy) { return true; } } return false; } private function getLDAPInfo(): string { $helper = Server::get(Helper::class); $output = new BufferedOutput(); // copy of OCA\User_LDAP\Command\ShowConfig::renderConfigs $configIDs = $helper->getServerConfigurationPrefixes(); foreach ($configIDs as $id) { $configHolder = new Configuration($id); $configuration = $configHolder->getConfiguration(); ksort($configuration); $table = new Table($output); $table->setHeaders(['Configuration', $id]); $rows = []; foreach ($configuration as $key => $value) { if ($key === 'ldapAgentPassword') { $value = '***'; } if (is_array($value)) { $value = implode(';', $value); } $rows[] = [$key, $value]; } $table->setRows($rows); $table->render(); } return $output->fetch(); } }