Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,16 @@ pipeline:
when:
matrix:
TESTS: integration-filesdrop-features
integration-ldap-features:
image: nextcloudci/integration-php7.0:integration-php7.0-3
commands:
- ./occ maintenance:install --admin-pass=admin
- ./occ app:enable user_ldap
- cd build/integration
- ./run.sh ldap_features/ldap-ocs.feature
when:
matrix:
TESTS: integration-ldap-features
nodb-codecov:
image: nextcloudci/php7.0:php7.0-7
commands:
Expand Down Expand Up @@ -410,6 +420,7 @@ matrix:
- TESTS: integration-sharees-features
- TESTS: integration-setup-features
- TESTS: integration-filesdrop-features
- TESTS: integration-ldap-features
- TESTS: jsunit
- TESTS: check-autoloader
- TESTS: app-check-code
Expand Down
10 changes: 10 additions & 0 deletions apps/user_ldap/appinfo/routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,13 @@
->actionInclude('user_ldap/ajax/testConfiguration.php');
$this->create('user_ldap_ajax_wizard', 'ajax/wizard.php')
->actionInclude('user_ldap/ajax/wizard.php');

$application = new \OCP\AppFramework\App('user_ldap');
$application->registerRoutes($this, [
'ocs' => [
['name' => 'ConfigAPI#create', 'url' => '/api/v1/config', 'verb' => 'POST'],
['name' => 'ConfigAPI#show', 'url' => '/api/v1/config/{configID}', 'verb' => 'GET'],
['name' => 'ConfigAPI#modify', 'url' => '/api/v1/config/{configID}', 'verb' => 'PUT'],
['name' => 'ConfigAPI#delete', 'url' => '/api/v1/config/{configID}', 'verb' => 'DELETE'],
]
]);
28 changes: 12 additions & 16 deletions apps/user_ldap/lib/Command/CreateEmptyConfig.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
use OCA\User_LDAP\Helper;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;

class CreateEmptyConfig extends Command {
Expand All @@ -47,29 +48,24 @@ protected function configure() {
$this
->setName('ldap:create-empty-config')
->setDescription('creates an empty LDAP configuration')
->addOption(
'only-print-prefix',
'p',
InputOption::VALUE_NONE,
'outputs only the prefix'
)
;
}

protected function execute(InputInterface $input, OutputInterface $output) {
$configPrefix = $this->getNewConfigurationPrefix();
$output->writeln("Created new configuration with configID '{$configPrefix}'");

$configPrefix = $this->helper->getNextServerConfigurationPrefix();
$configHolder = new Configuration($configPrefix);
$configHolder->saveConfiguration();
}

protected function getNewConfigurationPrefix() {
$serverConnections = $this->helper->getServerConfigurationPrefixes();

// first connection uses no prefix
if(sizeof($serverConnections) == 0) {
return '';
$prose = '';
if(!$input->getOption('only-print-prefix')) {
$prose = 'Created new configuration with configID ';
}

sort($serverConnections);
$lastKey = array_pop($serverConnections);
$lastNumber = intval(str_replace('s', '', $lastKey));
$nextPrefix = 's' . str_pad($lastNumber + 1, 2, '0', STR_PAD_LEFT);
return $nextPrefix;
$output->writeln($prose . "{$configPrefix}");
}
}
9 changes: 6 additions & 3 deletions apps/user_ldap/lib/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -393,9 +393,12 @@ protected function setRawValue($varName, $value) {
* @return bool
*/
protected function saveValue($varName, $value) {
return \OCP\Config::setAppValue('user_ldap',
$this->configPrefix.$varName,
$value);
\OC::$server->getConfig()->setAppValue(
'user_ldap',
$this->configPrefix.$varName,
$value
);
return true;
}

/**
Expand Down
Loading