removed "optional API Scope" support (#220)

* added URL encoding for Docker Container Pull action
* added two logs with `info` level for PullImage action
* removed "optional API Scope" support
* added AppAPI options toggles in Admin settings
* added RestartPolicy option to created containers

CI fails unrelated:
https://github.com/pytest-dev/pytest-asyncio/issues/737

---------

Signed-off-by: Alexander Piskun <bigcat88@icloud.com>
Signed-off-by: Andrey Borysenko <andrey18106x@gmail.com>
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
Co-authored-by: Andrey Borysenko <andrey18106x@gmail.com>
Co-authored-by: Nextcloud bot <bot@nextcloud.com>
Co-authored-by: rakekniven <2069590+rakekniven@users.noreply.github.com>
This commit is contained in:
Alexander Piskun
2024-02-01 21:58:00 +03:00
committed by GitHub
parent 1568a92eac
commit 7ad5541eae
22 changed files with 488 additions and 252 deletions

View File

@ -523,7 +523,7 @@ class ExAppsPageController extends Controller {
$daemonConfig->getProtocol(),
$daemonConfig->getHost(),
$daemonConfig->getDeployConfig(),
(int) explode('=', $deployParams['container_params']['env'][7])[1],
(int) explode('=', $deployParams['container_params']['env'][6])[1],
$auth,
);
if (!$this->service->heartbeatExApp($exAppUrl, $auth)) {
@ -560,26 +560,18 @@ class ExAppsPageController extends Controller {
}
// Register ExApp ApiScopes
$requestedExAppScopeGroups = $this->exAppService->getExAppRequestedScopes($exApp, $infoXml, $exAppInfo);
if (!$this->registerApiScopes($exApp, $requestedExAppScopeGroups, 'required')) {
return false;
}
$this->registerApiScopes($exApp, $requestedExAppScopeGroups, 'optional');
return true;
$requestedExAppScopeGroups = $this->exAppService->getExAppScopes($exApp, $infoXml, $exAppInfo);
return $this->registerApiScopes($exApp, $requestedExAppScopeGroups);
}
private function registerApiScopes(ExApp $exApp, array $requestedExAppScopeGroups, string $scopeType): bool {
private function registerApiScopes(ExApp $exApp, array $requestedExAppScopeGroups): bool {
$registeredScopeGroups = [];
foreach ($this->exAppApiScopeService->mapScopeNamesToNumbers($requestedExAppScopeGroups[$scopeType]) as $scopeGroup) {
foreach ($this->exAppApiScopeService->mapScopeNamesToNumbers($requestedExAppScopeGroups) as $scopeGroup) {
if ($this->exAppScopeService->setExAppScopeGroup($exApp, $scopeGroup)) {
$registeredScopeGroups[] = $scopeGroup;
}
}
if (count($registeredScopeGroups) !== count($requestedExAppScopeGroups['required'])) {
return false;
}
return true;
return count($registeredScopeGroups) === count($requestedExAppScopeGroups);
}
#[PasswordConfirmationRequired]
@ -704,13 +696,8 @@ class ExAppsPageController extends Controller {
}
private function upgradeExAppScopes(ExApp $exApp, SimpleXMLElement $infoXml): void {
$newExAppScopes = $this->exAppService->getExAppRequestedScopes($exApp, $infoXml);
$newExAppScopes = array_merge(
$this->exAppApiScopeService->mapScopeNamesToNumbers($newExAppScopes['required']),
$this->exAppApiScopeService->mapScopeNamesToNumbers($newExAppScopes['optional'])
);
$newExAppScopes = $this->exAppService->getExAppScopes($exApp, $infoXml);
$newExAppScopes = $this->exAppApiScopeService->mapScopeNamesToNumbers($newExAppScopes);
$this->exAppScopeService->updateExAppScopes($exApp, $newExAppScopes);
}