diff --git a/.github/workflows/tests-deploy.yml b/.github/workflows/tests-deploy.yml
index 06f47994..4f1eb896 100644
--- a/.github/workflows/tests-deploy.yml
+++ b/.github/workflows/tests-deploy.yml
@@ -73,12 +73,14 @@ jobs:
working-directory: apps/${{ env.APP_NAME }}
run: composer i
- - name: Set up & run Nextcloud
+ - name: Set up Nextcloud
env:
DB_PORT: 4444
run: |
mkdir data
- ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 --database-port=$DB_PORT --database-user=root --database-pass=rootpassword --admin-user admin --admin-pass admin
+ ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 \
+ --database-port=$DB_PORT --database-user=root --database-pass=rootpassword \
+ --admin-user admin --admin-pass admin
./occ config:system:set loglevel --value=0 --type=integer
./occ config:system:set debug --value=true --type=boolean
./occ config:system:set allow_local_remote_servers --value true
diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
new file mode 100644
index 00000000..f96d5f7c
--- /dev/null
+++ b/.github/workflows/tests.yml
@@ -0,0 +1,136 @@
+name: Tests
+
+on:
+ pull_request:
+ paths:
+ - '.github/workflows/tests.yml'
+ - 'lib/**'
+ push:
+ branches: [main]
+ paths:
+ - '.github/workflows/tests.yml'
+ - 'lib/**'
+ workflow_dispatch:
+
+jobs:
+ nc-py-api-pgsql:
+ runs-on: ubuntu-22.04
+ name: NC_Py_API • ${{ matrix.server-version }} • 🐘${{ matrix.php-version }} • PgSQL
+ strategy:
+ fail-fast: false
+ matrix:
+ php-version: [ '8.1' ]
+ server-version: [ 'stable26', 'stable27' ]
+ include:
+ - server-version: "master"
+ php-version: "8.2"
+ env:
+ NEXTCLOUD_URL: "http://localhost:8080/index.php"
+ APP_ID: "nc_py_api"
+ APP_PORT: 9009
+ APP_VERSION: "1.0.0"
+ APP_SECRET: "tC6vkwPhcppjMykD1r0n9NlI95uJMBYjs5blpIcA1PAdoPDmc5qoAjaBAkyocZ6E"
+ SKIP_NC_WO_AE: 1
+
+ services:
+ postgres:
+ image: ghcr.io/nextcloud/continuous-integration-postgres-14:latest
+ ports:
+ - 4444:5432/tcp
+ env:
+ POSTGRES_USER: root
+ POSTGRES_PASSWORD: rootpassword
+ POSTGRES_DB: nextcloud
+ options: --health-cmd pg_isready --health-interval 5s --health-timeout 2s --health-retries 5
+
+ steps:
+ - uses: actions/setup-python@v4
+ with:
+ python-version: '3.11'
+
+ - name: Set app env
+ run: echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
+
+ - name: Checkout server
+ uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
+ with:
+ submodules: true
+ repository: nextcloud/server
+ ref: ${{ matrix.server-version }}
+
+ - name: Checkout AppEcosystemV2
+ uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
+ with:
+ path: apps/${{ env.APP_NAME }}
+
+ - name: Set up php ${{ matrix.php-versions }}
+ uses: shivammathur/setup-php@4bd44f22a98a19e0950cbad5f31095157cc9621b # v2
+ with:
+ php-version: ${{ matrix.php-versions }}
+ extensions: bz2, ctype, curl, dom, fileinfo, gd, iconv, intl, json, libxml, mbstring, openssl, pcntl, posix, session, simplexml, xmlreader, xmlwriter, zip, zlib, pgsql, pdo_pgsql
+ coverage: none
+ ini-file: development
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Check composer file existence
+ id: check_composer
+ uses: andstor/file-existence-action@20b4d2e596410855db8f9ca21e96fbe18e12930b # v2
+ with:
+ files: apps/${{ env.APP_NAME }}/composer.json
+
+ - name: Set up dependencies
+ if: steps.check_composer.outputs.files_exists == 'true'
+ working-directory: apps/${{ env.APP_NAME }}
+ run: composer i
+
+ - name: Set up Nextcloud
+ env:
+ DB_PORT: 4444
+ run: |
+ mkdir data
+ ./occ maintenance:install --verbose --database=pgsql --database-name=nextcloud --database-host=127.0.0.1 \
+ --database-port=$DB_PORT --database-user=root --database-pass=rootpassword \
+ --admin-user admin --admin-pass admin
+ ./occ config:system:set allow_local_remote_servers --value true
+ ./occ app:enable --force ${{ env.APP_NAME }}
+ patch -p 1 -i apps/${{ env.APP_NAME }}/base_php.patch
+
+ - name: Run Nextcloud
+ run: php -S 127.0.0.1:8080 &
+
+ - name: Checkout NcPyApi
+ uses: actions/checkout@v3
+ with:
+ path: nc_py_api
+ repository: cloud-py-api/nc_py_api
+
+ - name: Install NcPyApi
+ working-directory: nc_py_api
+ run: python3 -m pip -v install ".[dev]"
+
+ - name: Register NcPyApi
+ run: |
+ cd nc_py_api
+ python3 tests/_install.py &
+ echo $! > /tmp/_install.pid
+ cd ..
+ sleep 5s
+ php occ app_ecosystem_v2:daemon:register docker-install Docker unix-socket 0 0
+ php occ app_ecosystem_v2:app:register \
+ "{\"appid\":\"$APP_ID\",\"name\":\"$APP_ID\",\"daemon_config_id\":1,\"version\":\"$APP_VERSION\",\"secret\":\"$APP_SECRET\",\"host\":\"localhost\",\"port\":$APP_PORT,\"system_app\":1}" \
+ -e --force-scopes
+ kill -15 $(cat /tmp/_install.pid)
+ timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null
+
+ - name: Run NC_Py_API tests
+ working-directory: nc_py_api
+ run: python3 -m pytest
+
+ - name: Upload NC logs
+ if: always()
+ uses: actions/upload-artifact@v3
+ with:
+ name: nc_py_api_${{ matrix.server-version }}_${{ matrix.php-version }}_nextcloud.log
+ path: data/nextcloud.log
+ if-no-files-found: warn
diff --git a/README.md b/README.md
index 0dafd2a0..50c21fad 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,5 @@
[![Tests - Deploy](https://github.com/cloud-py-api/app_ecosystem_v2/actions/workflows/tests-deploy.yml/badge.svg)](https://github.com/cloud-py-api/app_ecosystem_v2/actions/workflows/tests-deploy.yml)
+[![Tests](https://github.com/cloud-py-api/app_ecosystem_v2/actions/workflows/tests.yml/badge.svg)](https://github.com/cloud-py-api/app_ecosystem_v2/actions/workflows/tests.yml)
[![Docs](https://github.com/cloud-py-api/app_ecosystem_v2/actions/workflows/docs.yml/badge.svg)](https://cloud-py-api.github.io/app_ecosystem_v2/)
# Nextcloud App Ecosystem V2
diff --git a/lib/Command/Daemon/ListDaemons.php b/lib/Command/Daemon/ListDaemons.php
index 47642387..ffa9e558 100644
--- a/lib/Command/Daemon/ListDaemons.php
+++ b/lib/Command/Daemon/ListDaemons.php
@@ -59,12 +59,12 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$daemonConfigs = $this->daemonConfigService->getRegisteredDaemonConfigs();
if ($daemonConfigs === null) {
$output->writeln('Failed to get list of daemons.');
- return Command::FAILURE;
+ return 1;
}
if (count($daemonConfigs) === 0) {
$output->writeln('No registered daemon configs.');
- return Command::SUCCESS;
+ return 0;
}
$output->writeln('Registered ExApp daemon configs:');
@@ -72,6 +72,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln(sprintf('%s. %s [%s]: %s://%s', $daemon->getId(), $daemon->getDisplayName(), $daemon->getAcceptsDeployId(), $daemon->getProtocol(), $daemon->getHost()));
}
- return Command::SUCCESS;
+ return 0;
}
}
diff --git a/lib/Command/Daemon/RegisterDaemon.php b/lib/Command/Daemon/RegisterDaemon.php
index 5586a5be..7ca15dc1 100644
--- a/lib/Command/Daemon/RegisterDaemon.php
+++ b/lib/Command/Daemon/RegisterDaemon.php
@@ -88,10 +88,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($daemonConfig === null) {
$output->writeln('Failed to register daemon.');
- return Command::FAILURE;
+ return 1;
}
$output->writeln(sprintf('Daemon successfully registered. Daemon config ID: %s', $daemonConfig->getId()));
- return Command::SUCCESS;
+ return 0;
}
}
diff --git a/lib/Command/Daemon/UnregisterDaemon.php b/lib/Command/Daemon/UnregisterDaemon.php
index c2103745..9b5ca506 100644
--- a/lib/Command/Daemon/UnregisterDaemon.php
+++ b/lib/Command/Daemon/UnregisterDaemon.php
@@ -60,15 +60,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$daemonConfig = $this->daemonConfigService->getDaemonConfig($daemonConfigId);
if ($daemonConfig === null) {
$output->writeln('Daemon config not found.');
- return Command::FAILURE;
+ return 1;
}
if ($this->daemonConfigService->unregisterDaemonConfig($daemonConfig) === null) {
$output->writeln('Failed to unregister daemon config.');
- return Command::FAILURE;
+ return 1;
}
$output->writeln('Daemon config unregistered.');
- return Command::SUCCESS;
+ return 0;
}
}
diff --git a/lib/Command/ExApp/Deploy.php b/lib/Command/ExApp/Deploy.php
index 858bd4ec..7fe6f0ca 100644
--- a/lib/Command/ExApp/Deploy.php
+++ b/lib/Command/ExApp/Deploy.php
@@ -92,30 +92,30 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$pathToInfoXml = $input->getOption('info-xml');
if ($pathToInfoXml === null) {
$output->writeln(sprintf('No info.xml specified for %s', $appId));
- return Command::INVALID;
+ return 2;
}
$infoXml = simplexml_load_file($pathToInfoXml);
if ($infoXml === false) {
$output->writeln(sprintf('Failed to load info.xml from %s', $pathToInfoXml));
- return Command::INVALID;
+ return 2;
}
if ($appId !== (string) $infoXml->id) {
$output->writeln(sprintf('ExApp appid %s does not match appid in info.xml (%s)', $appId, $infoXml->id));
- return Command::INVALID;
+ return 2;
}
$exApp = $this->service->getExApp($appId);
if ($exApp !== null) {
$output->writeln(sprintf('ExApp %s already deployed and registered.', $appId));
- return Command::INVALID;
+ return 2;
}
$daemonConfigId = (int) $input->getArgument('daemon-config-id');
$daemonConfig = $this->daemonConfigService->getDaemonConfig($daemonConfigId);
if ($daemonConfig === null) {
$output->writeln(sprintf('Daemon config %s not found.', $daemonConfigId));
- return Command::INVALID;
+ return 2;
}
$deployConfig = $daemonConfig->getDeployConfig();
@@ -151,7 +151,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if (isset($pullResult['error'])) {
$output->writeln(sprintf('ExApp %s deployment failed. Error: %s', $appId, $pullResult['error']));
- return Command::FAILURE;
+ return 1;
}
if (!isset($startResult['error']) && isset($createResult['Id'])) {
@@ -168,14 +168,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
];
if ($this->heartbeatExApp($resultOutput, $daemonConfig->getId())) {
$output->writeln(json_encode($resultOutput, JSON_UNESCAPED_SLASHES));
- return Command::SUCCESS;
+ return 0;
}
$output->writeln(sprintf('ExApp %s heartbeat check failed. Make sure container started and initialized correctly.', $appId));
} else {
$output->writeln(sprintf('ExApp %s deployment failed. Error: %s', $appId, $startResult['error'] ?? $createResult['error']));
}
- return Command::FAILURE;
+ return 1;
}
private function buildDeployEnvParams(array $params, array $envOptions, array $deployConfig): array {
diff --git a/lib/Command/ExApp/Disable.php b/lib/Command/ExApp/Disable.php
index fb253312..fa690ad5 100644
--- a/lib/Command/ExApp/Disable.php
+++ b/lib/Command/ExApp/Disable.php
@@ -59,19 +59,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($exApp === null) {
$output->writeln(sprintf('ExApp %s not found. Failed to disable.', $appId));
- return Command::FAILURE;
+ return 1;
}
if (!$exApp->getEnabled()) {
$output->writeln(sprintf('ExApp %s already disabled.', $appId));
- return Command::SUCCESS;
+ return 0;
}
if ($this->service->disableExApp($exApp)) {
$output->writeln(sprintf('ExApp %s successfully disabled.', $appId));
- return Command::SUCCESS;
+ return 0;
}
$output->writeln(sprintf('Failed to disable ExApp %s.', $appId));
- return Command::FAILURE;
+ return 1;
}
}
diff --git a/lib/Command/ExApp/Enable.php b/lib/Command/ExApp/Enable.php
index bf8ee56d..49f15f89 100644
--- a/lib/Command/ExApp/Enable.php
+++ b/lib/Command/ExApp/Enable.php
@@ -60,19 +60,19 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($exApp === null) {
$output->writeln(sprintf('ExApp %s not found. Failed to enable.', $appId));
- return Command::FAILURE;
+ return 1;
}
if ($exApp->getEnabled()) {
$output->writeln(sprintf('ExApp %s already enabled.', $appId));
- return Command::SUCCESS;
+ return 0;
}
if ($this->service->enableExApp($exApp)) {
$output->writeln(sprintf('ExApp %s successfully enabled.', $appId));
- return Command::SUCCESS;
+ return 0;
}
$output->writeln(sprintf('Failed to enable ExApp %s.', $appId));
- return Command::FAILURE;
+ return 1;
}
}
diff --git a/lib/Command/ExApp/ListExApps.php b/lib/Command/ExApp/ListExApps.php
index dca0500f..7ddf386b 100644
--- a/lib/Command/ExApp/ListExApps.php
+++ b/lib/Command/ExApp/ListExApps.php
@@ -61,8 +61,8 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
} catch (Exception) {
$output->writeln('Failed to get list of ExApps');
- return Command::FAILURE;
+ return 1;
}
- return Command::SUCCESS;
+ return 0;
}
}
diff --git a/lib/Command/ExApp/Register.php b/lib/Command/ExApp/Register.php
index 1181d0a6..79a13831 100644
--- a/lib/Command/ExApp/Register.php
+++ b/lib/Command/ExApp/Register.php
@@ -77,7 +77,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$deployJsonOutput = json_decode($input->getArgument('deploy-json-output'), true);
if ($deployJsonOutput === null) {
$output->writeln('Invalid deploy JSON output.');
- return Command::INVALID;
+ return 2;
}
$appId = $deployJsonOutput['appid'];
@@ -91,13 +91,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($this->service->getExApp($appId) !== null) {
$output->writeln(sprintf('ExApp %s already registered.', $appId));
- return Command::INVALID;
+ return 2;
}
$daemonConfig = $this->daemonConfigService->getDaemonConfig($daemonConfigId);
if ($daemonConfig === null) {
$output->writeln(sprintf('Daemon config %s not found.', $daemonConfigId));
- return Command::INVALID;
+ return 2;
}
$exApp = $this->service->registerExApp($appId, [
@@ -119,7 +119,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
catch (Exception $e) {
$output->writeln(sprintf('Error while setting app system flag: %s', $e->getMessage()));
- return Command::FAILURE;
+ return 1;
}
}
@@ -128,7 +128,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln(sprintf('Failed to get requested ExApp scopes for %s.', $appId));
// Fallback unregistering ExApp
$this->service->unregisterExApp($exApp->getAppid());
- return Command::INVALID;
+ return 2;
}
$forceScopes = (bool) $input->getOption('force-scopes');
@@ -160,7 +160,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln(sprintf('ExApp %s required scopes not approved.', $appId));
// Fallback unregistering ExApp
$this->service->unregisterExApp($exApp->getAppid());
- return Command::FAILURE;
+ return 1;
}
if (count($requestedExAppScopeGroups['required']) > 0) {
@@ -178,15 +178,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln(sprintf('Failed to enable ExApp %s.', $appId));
// Fallback unregistering ExApp
$this->service->unregisterExApp($exApp->getAppid());
- return Command::FAILURE;
+ return 1;
}
}
- return Command::SUCCESS;
+ return 0;
}
$output->writeln(sprintf('Failed to register ExApp %s.', $appId));
- return Command::FAILURE;
+ return 1;
}
private function registerExAppScopes($output, ExApp $exApp, array $requestedExAppScopeGroups, bool $required = true): void {
diff --git a/lib/Command/ExApp/Unregister.php b/lib/Command/ExApp/Unregister.php
index fdaba9c3..22649b27 100644
--- a/lib/Command/ExApp/Unregister.php
+++ b/lib/Command/ExApp/Unregister.php
@@ -66,7 +66,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$exApp = $this->service->getExApp($appId);
if ($exApp === null) {
$output->writeln(sprintf('ExApp %s not found. Failed to unregister.', $appId));
- return Command::FAILURE;
+ return 1;
}
$silent = $input->getOption('silent');
@@ -76,14 +76,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln(sprintf('ExApp %s successfully disabled.', $appId));
} else {
$output->writeln(sprintf('ExApp %s not disabled. Failed to disable.', $appId));
- return Command::FAILURE;
+ return 1;
}
}
$exApp = $this->service->unregisterExApp($appId);
if ($exApp === null) {
$output->writeln(sprintf('Failed to unregister ExApp %s.', $appId));
- return Command::FAILURE;
+ return 1;
}
if ($exApp->getAppid() === $appId) {
$appScopes = $this->service->getExAppScopeGroups($exApp);
@@ -93,6 +93,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
$output->writeln(sprintf('ExApp %s successfully unregistered.', $appId));
- return Command::SUCCESS;
+ return 0;
}
}
diff --git a/lib/Command/ExAppConfig/DeleteConfig.php b/lib/Command/ExAppConfig/DeleteConfig.php
index 5a83529f..9c6c9491 100644
--- a/lib/Command/ExAppConfig/DeleteConfig.php
+++ b/lib/Command/ExAppConfig/DeleteConfig.php
@@ -63,22 +63,22 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$exApp = $this->service->getExApp($appId);
if ($exApp === null) {
$output->writeln(sprintf('ExApp %s not found.', $appId));
- return Command::FAILURE;
+ return 1;
}
if ($exApp->getEnabled()) {
$configKey = $input->getArgument('configkey');
$exAppConfig = $this->exAppConfigService->getAppConfig($appId, $configKey);
if ($exAppConfig === null) {
$output->writeln(sprintf('ExApp %s config %s not found.', $appId, $configKey));
- return Command::FAILURE;
+ return 1;
}
if ($this->exAppConfigService->deleteAppConfig($exAppConfig) !== 1) {
$output->writeln(sprintf('Failed to delete ExApp %s config %s.', $appId, $configKey));
- return Command::FAILURE;
+ return 1;
}
$output->writeln(sprintf('ExApp %s config %s deleted.', $appId, $configKey));
- return Command::SUCCESS;
+ return 0;
}
- return Command::FAILURE;
+ return 1;
}
}
diff --git a/lib/Command/ExAppConfig/GetConfig.php b/lib/Command/ExAppConfig/GetConfig.php
index 732b8199..6dffa5bf 100644
--- a/lib/Command/ExAppConfig/GetConfig.php
+++ b/lib/Command/ExAppConfig/GetConfig.php
@@ -66,13 +66,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$exApp = $this->service->getExApp($appId);
if ($exApp === null) {
$output->writeln(sprintf('ExApp % not found.', $appId));
- return Command::FAILURE;
+ return 1;
}
$configKey = $input->getArgument('configkey');
if ($configKey === null || $configKey === '') {
$output->writeln('Config key is required.');
- return Command::FAILURE;
+ return 1;
}
$exAppConfig = $this->exAppConfigService->getAppConfig($appId, $configKey);
@@ -80,15 +80,15 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($exAppConfig === null) {
if (isset($defaultValue)) {
$output->writeln($defaultValue);
- return Command::SUCCESS;
+ return 0;
}
$output->writeln(sprintf('ExApp %s config %s not found', $appId, $configKey));
- return Command::FAILURE;
+ return 1;
}
$value = $exAppConfig->getConfigvalue() ?? $defaultValue;
$output->writeln($value);
- return Command::SUCCESS;
+ return 0;
}
}
diff --git a/lib/Command/ExAppConfig/ListConfig.php b/lib/Command/ExAppConfig/ListConfig.php
index ac1994d8..595c90a4 100644
--- a/lib/Command/ExAppConfig/ListConfig.php
+++ b/lib/Command/ExAppConfig/ListConfig.php
@@ -66,7 +66,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$exApp = $this->service->getExApp($appId);
if ($exApp === null) {
$output->writeln(sprintf('ExApp %s not found.', $appId));
- return Command::FAILURE;
+ return 1;
}
$exAppConfigs = $this->appConfigService->getAllAppConfig($exApp->getAppid());
@@ -77,6 +77,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$appConfigs[$exAppConfig->getAppid()][$exAppConfig->getConfigkey()] = ($private && !$exAppConfig->getSensitive() ? $exAppConfig->getConfigvalue() : self::SENSITIVE_VALUE);
}
$output->writeln(json_encode($appConfigs, JSON_PRETTY_PRINT));
- return Command::SUCCESS;
+ return 0;
}
}
diff --git a/lib/Command/ExAppConfig/SetConfig.php b/lib/Command/ExAppConfig/SetConfig.php
index a9e14f96..c0b15372 100644
--- a/lib/Command/ExAppConfig/SetConfig.php
+++ b/lib/Command/ExAppConfig/SetConfig.php
@@ -68,7 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$exApp = $this->service->getExApp($appId);
if ($exApp === null) {
$output->writeln('ExApp ' . $appId . ' not found');
- return Command::FAILURE;
+ return 1;
}
if ($exApp->getEnabled()) {
@@ -81,27 +81,27 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$exAppConfig = $this->exAppConfigService->setAppConfigValue($appId, $configKey, $value, (int) $sensitive);
if ($exAppConfig === null) {
$output->writeln('ExApp ' . $appId . ' config ' . $configKey . ' not found');
- return Command::FAILURE;
+ return 1;
}
} else {
$exAppConfig = $this->exAppConfigService->getAppConfig($appId, $configKey);
if ($exAppConfig === null) {
$output->writeln('ExApp ' . $appId . ' config ' . $configKey . ' not found');
- return Command::FAILURE;
+ return 1;
}
$exAppConfig->setConfigvalue($value);
$exAppConfig->setSensitive((int) $sensitive);
if ($this->exAppConfigService->updateAppConfigValue($exAppConfig) !== 1) {
$output->writeln('ExApp ' . $appId . ' config ' . $configKey . ' not updated');
- return Command::FAILURE;
+ return 1;
}
}
$sensitiveMsg = $sensitive ? '[sensitive]' : '';
$output->writeln('ExApp ' . $appId . ' config ' . $configKey . ' set to ' . $value . ' ' . $sensitiveMsg);
- return Command::SUCCESS;
+ return 0;
}
$output->writeln('ExApp ' . $appId . ' is disabled');
- return Command::FAILURE;
+ return 1;
}
}
diff --git a/lib/Controller/AppConfigController.php b/lib/Controller/AppConfigController.php
index ef881d5d..58732f4b 100644
--- a/lib/Controller/AppConfigController.php
+++ b/lib/Controller/AppConfigController.php
@@ -61,6 +61,9 @@ public function __construct(
}
/**
+ * @PublicPage
+ * @NoCSRFRequired
+ *
* @param string $configKey
* @param mixed $configValue
* @param string $format
@@ -84,6 +87,9 @@ public function setAppConfigValue(string $configKey, mixed $configValue, string
}
/**
+ * @PublicPage
+ * @NoCSRFRequired
+ *
* @param array $configKeys
* @param string $format
*
@@ -99,6 +105,9 @@ public function getAppConfigValues(array $configKeys, string $format = 'json'):
}
/**
+ * @PublicPage
+ * @NoCSRFRequired
+ *
* @param array $configKeys
* @param string $format
*
diff --git a/lib/Controller/ConfigController.php b/lib/Controller/ConfigController.php
index 29dbb472..b4fea80c 100644
--- a/lib/Controller/ConfigController.php
+++ b/lib/Controller/ConfigController.php
@@ -52,6 +52,8 @@ public function __construct(
}
/**
+ * @NoCSRFRequired
+ *
* Set Admin config values
*
* @param array $values
diff --git a/lib/Controller/ExAppController.php b/lib/Controller/ExAppController.php
index 1b233f32..4e70b11d 100644
--- a/lib/Controller/ExAppController.php
+++ b/lib/Controller/ExAppController.php
@@ -31,7 +31,6 @@
namespace OCA\AppEcosystemV2\Controller;
-use OCP\AppFramework\Http\Attribute\NoAdminRequired;
use OCP\AppFramework\Http\Attribute\NoCSRFRequired;
use OCP\IRequest;
use OCP\AppFramework\OCSController;
@@ -54,6 +53,14 @@ public function __construct(
$this->service = $service;
}
+ /**
+ * @NoCSRFRequired
+ *
+ * @param bool $extended
+ * @param string $format
+ *
+ * @return Response
+ */
#[NoCSRFRequired]
public function getExApps(bool $extended = false, string $format = 'json'): Response {
return $this->buildResponse(new DataResponse($this->service->getExAppsList($extended), Http::STATUS_OK), $format);
diff --git a/lib/Controller/OcsApiController.php b/lib/Controller/OcsApiController.php
index c086ab95..b2333fb1 100644
--- a/lib/Controller/OcsApiController.php
+++ b/lib/Controller/OcsApiController.php
@@ -83,6 +83,10 @@ public function __construct(
}
/**
+ * @PublicPage
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ *
* @param int $level
* @param string $message
* @param string $format
@@ -122,6 +126,8 @@ public function log(
}
/**
+ * @NoCSRFRequired
+ *
* @param string $appId
* @param array $appData
* @param string $format
@@ -139,6 +145,8 @@ public function registerExternalApp(string $appId, array $appData, string $forma
}
/**
+ * @NoCSRFRequired
+ *
* @param string $appId
* @param string $format
*
@@ -161,6 +169,9 @@ public function unregisterExternalApp(string $appId, string $format = 'json'): R
}
/**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ *
* @param string $appId
* @param string $format
*
@@ -180,6 +191,9 @@ public function getAppStatus(string $appId, string $format = 'json'): Response {
}
/**
+ * @PublicPage
+ * @NoCSRFRequired
+ *
* @param array $fileActionMenuParams [name, display_name, mime, permissions, order, icon, icon_class, action_handler]
* @param string $format
*
@@ -198,6 +212,9 @@ public function registerFileActionMenu(array $fileActionMenuParams, string $form
}
/**
+ * @PublicPage
+ * @NoCSRFRequired
+ *
* @param string $fileActionMenuName
* @param string $format
*
@@ -216,6 +233,9 @@ public function unregisterFileActionMenu(string $fileActionMenuName, string $for
}
/**
+ * @NoCSRFRequired
+ * @NoAdminRequired
+ *
* @param string $appId
* @param string $actionName
* @param array $actionFile
@@ -235,6 +255,9 @@ public function handleFileAction(string $appId, string $actionName, array $actio
}
/**
+ * @NoAdminRequired
+ * @NoCSRFRequired
+ *
* @param string $appId
* @param string $exFileActionName
*
@@ -257,6 +280,9 @@ public function loadFileActionIcon(string $appId, string $exFileActionName): Dat
}
/**
+ * @PublicPage
+ * @NoCSRFRequired
+ *
* @param string $format
*
* @return Response
@@ -269,6 +295,9 @@ public function getExAppUsers(string $format = 'json'): Response {
}
/**
+ * @PublicPage
+ * @NoCSRFRequired
+ *
* @param string $apiRoute
* @param int $scopeGroup
* @param string $name
diff --git a/lib/Controller/PreferencesController.php b/lib/Controller/PreferencesController.php
index 0270084b..bd33b6a3 100644
--- a/lib/Controller/PreferencesController.php
+++ b/lib/Controller/PreferencesController.php
@@ -64,6 +64,9 @@ public function __construct(
}
/**
+ * @PublicPage
+ * @NoCSRFRequired
+ *
* @param string $configKey
* @param mixed $configValue
* @param string $format
@@ -88,6 +91,9 @@ public function setUserConfigValue(string $configKey, mixed $configValue, string
}
/**
+ * @PublicPage
+ * @NoCSRFRequired
+ *
* @param array $configKeys
* @param string $format
*
@@ -104,6 +110,9 @@ public function getUserConfigValues(array $configKeys, string $format = 'json'):
}
/**
+ * @PublicPage
+ * @NoCSRFRequired
+ *
* @param array $configKeys
* @param string $format
*
diff --git a/lib/Middleware/AEAuthMiddleware.php b/lib/Middleware/AEAuthMiddleware.php
index 04da0a24..2ef73fd8 100644
--- a/lib/Middleware/AEAuthMiddleware.php
+++ b/lib/Middleware/AEAuthMiddleware.php
@@ -68,7 +68,7 @@ public function __construct(
$this->logger = $logger;
}
- public function beforeController(Controller $controller, string $methodName) {
+ public function beforeController($controller, $methodName) {
$reflectionMethod = new ReflectionMethod($controller, $methodName);
$isAEAuth = $this->hasAnnotationOrAttribute($reflectionMethod, 'AEAuth', AppEcosystemAuth::class);