Disable testing app only conditionally

Signed-off-by: Lukas Reschke <lukas@statuscode.ch>
This commit is contained in:
Lukas Reschke 2021-06-02 18:01:04 +02:00
parent 4cc3180429
commit a4f6e198a1
1 changed files with 27 additions and 2 deletions

View File

@ -417,9 +417,34 @@ trait Provisioning {
private function flushDeletedUserList() {
$previousUser = $this->currentUser;
$this->currentUser = 'admin';
$this->sendingTo('POST', "/cloud/apps/testing");
$fullUrl = $this->baseUrl . "v2.php/cloud/apps?filter=disabled";
$client = new Client();
$options = [];
if ($this->currentUser === 'admin') {
$options['auth'] = $this->adminUser;
}
$options['headers'] = [
'OCS-APIREQUEST' => 'true',
];
$response = $client->get($fullUrl, $options);
$respondedArray = $this->getArrayOfAppsResponded($response);
$isTestingAppEnabled = true;
if (array_key_exists('testing', $respondedArray)) {
$isTestingAppEnabled = false;
}
if (!$isTestingAppEnabled) {
$this->sendingTo('POST', "/cloud/apps/testing");
}
$this->sendingTo('POST', "/apps/testing/api/v1/flushDupeUsernames");
$this->sendingTo('DELETE', "/cloud/apps/testing");
if (!$isTestingAppEnabled) {
$this->sendingTo('DELETE', "/cloud/apps/testing");
}
$this->currentUser = $previousUser;
}