Browse Source

Testing app switch to force-enable test user backend

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
tags/v12.0.0beta1
Vincent Petry 7 years ago
parent
commit
504a1f0d57
No account linked to committer's email address
2 changed files with 14 additions and 2 deletions
  1. 1
    1
      apps/testing/appinfo/info.xml
  2. 13
    1
      apps/testing/lib/Application.php

+ 1
- 1
apps/testing/appinfo/info.xml View File

@@ -10,6 +10,6 @@
<nextcloud min-version="12" max-version="12" />
</dependencies>
<types>
<type>prelogin</type>
<authentication/>
</types>
</info>

+ 13
- 1
apps/testing/lib/Application.php View File

@@ -22,9 +22,21 @@
namespace OCA\Testing;

use OCP\AppFramework\App;
use OCA\Testing\AlternativeHomeUserBackend;

class Application extends App {
public function __construct (array $urlParams = array()) {
parent::__construct('testing', $urlParams);
$appName = 'testing';
parent::__construct($appName, $urlParams);

$c = $this->getContainer();
$config = $c->getServer()->getConfig();
if ($config->getAppValue($appName, 'enable_alt_user_backend', 'no') === 'yes') {
$userManager = $c->getServer()->getUserManager();

// replace all user backends with this one
$userManager->clearBackends();
$userManager->registerBackend($c->query(AlternativeHomeUserBackend::class));
}
}
}

Loading…
Cancel
Save