diff --git a/lib/Command/Install.php b/lib/Command/Install.php index bd233f8302..2fa80fbb02 100644 --- a/lib/Command/Install.php +++ b/lib/Command/Install.php @@ -9,7 +9,7 @@ namespace OCA\Libresign\Command; use OCA\Libresign\Service\Install\InstallService; -use OCP\AppFramework\Services\IAppConfig; +use OCP\IAppConfig; use OCP\IConfig; use Psr\Log\LoggerInterface; use Symfony\Component\Console\Input\InputInterface; @@ -121,7 +121,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int $ok = true; } if ($input->getOption('cfssl') || $all) { - $currentEngine = $this->appConfig->getAppValue('certificate_engine', 'openssl'); + $currentEngine = $this->appConfig->getValueString('certificate_engine', 'openssl'); $this->installService->installCfssl(); if ($currentEngine !== 'cfssl') { $output->writeln('To use CFSSL, set the engine to cfssl with: config:app:set libresign certificate_engine --value cfssl'); diff --git a/lib/Controller/AdminController.php b/lib/Controller/AdminController.php index 28114b2649..a8cf3cf59d 100644 --- a/lib/Controller/AdminController.php +++ b/lib/Controller/AdminController.php @@ -20,7 +20,7 @@ use OCP\AppFramework\Http\Attribute\ApiRoute; use OCP\AppFramework\Http\Attribute\NoCSRFRequired; use OCP\AppFramework\Http\DataResponse; -use OCP\AppFramework\Services\IAppConfig; +use OCP\IAppConfig; use OCP\IEventSource; use OCP\IEventSourceFactory; use OCP\IL10N; @@ -225,7 +225,7 @@ public function installAndValidate(): void { $this->installService->installJava($async); $this->installService->installJSignPdf($async); $this->installService->installPdftk($async); - if ($this->appConfig->getAppValue('certificate_engine') === 'cfssl') { + if ($this->appConfig->getValueString(Application::APP_ID, 'certificate_engine') === 'cfssl') { $this->installService->installCfssl($async); } diff --git a/lib/Controller/PageController.php b/lib/Controller/PageController.php index cae9b3ae7d..856eb28231 100644 --- a/lib/Controller/PageController.php +++ b/lib/Controller/PageController.php @@ -36,9 +36,9 @@ use OCP\AppFramework\Http\FileDisplayResponse; use OCP\AppFramework\Http\RedirectResponse; use OCP\AppFramework\Http\TemplateResponse; -use OCP\AppFramework\Services\IAppConfig; use OCP\AppFramework\Services\IInitialState; use OCP\EventDispatcher\IEventDispatcher; +use OCP\IAppConfig; use OCP\IL10N; use OCP\IRequest; use OCP\IURLGenerator; @@ -95,7 +95,7 @@ public function index(): TemplateResponse { $this->provideSignerSignatues(); $this->initialState->provideInitialState('identify_methods', $this->identifyMethodService->getIdentifyMethodsSettings()); - $this->initialState->provideInitialState('legal_information', $this->appConfig->getAppValue('legal_information')); + $this->initialState->provideInitialState('legal_information', $this->appConfig->getValueString(Application::APP_ID, 'legal_information')); Util::addScript(Application::APP_ID, 'libresign-main'); @@ -575,7 +575,7 @@ public function validationFilePublic(string $uuid): TemplateResponse { ); } - $this->initialState->provideInitialState('legal_information', $this->appConfig->getAppValue('legal_information')); + $this->initialState->provideInitialState('legal_information', $this->appConfig->getValueString(Application::APP_ID, 'legal_information')); $this->initialState->provideInitialState('file_info', $this->fileService @@ -598,7 +598,7 @@ public function validationFilePublic(string $uuid): TemplateResponse { } private function throwIfValidationPageNotAccessible(): void { - $isValidationUrlPrivate = (bool)$this->appConfig->getAppValue('make_validation_url_private', '0'); + $isValidationUrlPrivate = (bool)$this->appConfig->getValueBool(Application::APP_ID, 'make_validation_url_private', false); if ($this->userSession->isLoggedIn()) { return; } diff --git a/lib/Handler/CertificateEngine/AEngineHandler.php b/lib/Handler/CertificateEngine/AEngineHandler.php index 989ed59b1f..7ec79af234 100644 --- a/lib/Handler/CertificateEngine/AEngineHandler.php +++ b/lib/Handler/CertificateEngine/AEngineHandler.php @@ -8,14 +8,15 @@ namespace OCA\Libresign\Handler\CertificateEngine; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Exception\EmptyCertificateException; use OCA\Libresign\Exception\InvalidPasswordException; use OCA\Libresign\Exception\LibresignException; use OCA\Libresign\Helper\MagicGetterSetterTrait; -use OCP\AppFramework\Services\IAppConfig; use OCP\Files\AppData\IAppDataFactory; use OCP\Files\IAppData; use OCP\Files\SimpleFS\ISimpleFolder; +use OCP\IAppConfig; use OCP\IConfig; use OCP\IDateTimeFormatter; use OCP\ITempManager; @@ -187,19 +188,18 @@ public function translateToLong($name): string { } public function setEngine(string $engine): void { - $this->appConfig->setAppValue('certificate_engine', $engine); + $this->appConfig->setValueString(Application::APP_ID, 'certificate_engine', $engine); $this->engine = $engine; } public function getEngine(): string { - $this->engine = $this->appConfig->getAppValue('certificate_engine', 'openssl'); + $this->engine = $this->appConfig->getValueString(Application::APP_ID, 'certificate_engine', 'openssl'); return $this->engine; } public function populateInstance(array $rootCert): self { if (empty($rootCert)) { - $rootCert = $this->appConfig->getAppValue('root_cert'); - $rootCert = json_decode($rootCert, true); + $rootCert = $this->appConfig->getValueString(Application::APP_ID, 'root_cert'); } if (!$rootCert) { return $this; @@ -224,7 +224,7 @@ public function getConfigPath(): string { if ($this->configPath) { return $this->configPath; } - $this->configPath = $this->appConfig->getAppValue('config_path'); + $this->configPath = $this->appConfig->getValueString(Application::APP_ID, 'config_path'); if ($this->configPath && str_ends_with($this->configPath, $this->getName() . '_config')) { return $this->configPath; } @@ -264,9 +264,9 @@ private function getInternalPathOfFolder(ISimpleFolder $node): string { public function setConfigPath(string $configPath): void { if (!$configPath) { - $this->appConfig->deleteAppValue('config_path'); + $this->appConfig->deleteKey(Application::APP_ID, 'config_path'); } else { - $this->appConfig->setAppValue('config_path', $configPath); + $this->appConfig->setValueString(Application::APP_ID, 'config_path', $configPath); } $this->configPath = $configPath; } @@ -300,7 +300,7 @@ public function getUID(): string { } public function expirity(): int { - $expirity = $this->appConfig->getAppValueInt('expiry_in_days', 365); + $expirity = $this->appConfig->getValueInt(Application::APP_ID, 'expiry_in_days', 365); if ($expirity < 0) { return 365; } @@ -308,7 +308,7 @@ public function expirity(): int { } public function isSetupOk(): bool { - return $this->appConfig->getAppValue('authkey') ? true : false; + return $this->appConfig->getValueBool(Application::APP_ID, 'authkey', false); } public function configureCheck(): array { diff --git a/lib/Handler/CertificateEngine/CfsslHandler.php b/lib/Handler/CertificateEngine/CfsslHandler.php index 47a1293dfb..42bb7603ff 100644 --- a/lib/Handler/CertificateEngine/CfsslHandler.php +++ b/lib/Handler/CertificateEngine/CfsslHandler.php @@ -12,12 +12,13 @@ use GuzzleHttp\Exception\ConnectException; use GuzzleHttp\Exception\RequestException; use OC\SystemConfig; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Exception\LibresignException; use OCA\Libresign\Handler\CfsslServerHandler; use OCA\Libresign\Helper\ConfigureCheckHelper; use OCA\Libresign\Service\Install\InstallService; -use OCP\AppFramework\Services\IAppConfig; use OCP\Files\AppData\IAppDataFactory; +use OCP\IAppConfig; use OCP\IConfig; use OCP\IDateTimeFormatter; use OCP\ITempManager; @@ -125,7 +126,7 @@ public function configureCheck(): array { public function toArray(): array { $return = parent::toArray(); if (!empty($return['configPath'])) { - $return['cfsslUri'] = $this->appConfig->getAppValue('cfssl_uri'); + $return['cfsslUri'] = $this->appConfig->getValueString(Application::APP_ID, 'cfssl_uri'); } return $return; } @@ -316,7 +317,7 @@ private function getBinary(): string { $appKeys = $this->appConfig->getAppKeys(); $binary = ''; if (in_array('cfssl_bin', $appKeys)) { - $binary = $this->appConfig->getAppValue('cfssl_bin'); + $binary = $this->appConfig->getValueString(Application::APP_ID, 'cfssl_bin'); if (!file_exists($binary)) { $this->appConfig->deleteAppValue('cfssl_bin'); } @@ -340,7 +341,7 @@ private function getCfsslUri(): string { $appKeys = $this->appConfig->getAppKeys(); if (in_array('cfssl_uri', $appKeys)) { - if ($uri = $this->appConfig->getAppValue('cfssl_uri')) { + if ($uri = $this->appConfig->getValueString(Application::APP_ID, 'cfssl_uri')) { return $uri; } // In case config is an empty string @@ -368,7 +369,7 @@ private function checkBinaries(): array { ->setResource('cfssl'), ]; } - $binary = $this->appConfig->getAppValue('cfssl_bin'); + $binary = $this->appConfig->getValueString(Application::APP_ID, 'cfssl_bin'); if (!$binary) { return [ (new ConfigureCheckHelper()) diff --git a/lib/Handler/CertificateEngine/Handler.php b/lib/Handler/CertificateEngine/Handler.php index 22e3d9a90d..46e2ca952c 100644 --- a/lib/Handler/CertificateEngine/Handler.php +++ b/lib/Handler/CertificateEngine/Handler.php @@ -8,8 +8,9 @@ namespace OCA\Libresign\Handler\CertificateEngine; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Exception\LibresignException; -use OCP\AppFramework\Services\IAppConfig; +use OCP\IAppConfig; class Handler { public function __construct( @@ -25,7 +26,7 @@ public function __construct( */ public function getEngine(string $engineName = '', array $rootCert = []): AEngineHandler { if (!$engineName) { - $engineName = $this->appConfig->getAppValue('certificate_engine', 'openssl'); + $engineName = $this->appConfig->getValueString(Application::APP_ID, 'certificate_engine', 'openssl'); } if ($engineName === 'openssl') { $engine = $this->openSslHandler; diff --git a/lib/Handler/CertificateEngine/OpenSslHandler.php b/lib/Handler/CertificateEngine/OpenSslHandler.php index b6f761176b..b038a0efb0 100644 --- a/lib/Handler/CertificateEngine/OpenSslHandler.php +++ b/lib/Handler/CertificateEngine/OpenSslHandler.php @@ -10,8 +10,8 @@ use OCA\Libresign\Exception\LibresignException; use OCA\Libresign\Helper\ConfigureCheckHelper; -use OCP\AppFramework\Services\IAppConfig; use OCP\Files\AppData\IAppDataFactory; +use OCP\IAppConfig; use OCP\IConfig; use OCP\IDateTimeFormatter; use OCP\ITempManager; diff --git a/lib/Handler/FooterHandler.php b/lib/Handler/FooterHandler.php index c0017ae888..0a59730f80 100644 --- a/lib/Handler/FooterHandler.php +++ b/lib/Handler/FooterHandler.php @@ -18,10 +18,11 @@ use Endroid\QrCode\Writer\PngWriter; use League\Plates\Engine; use Mpdf\Mpdf; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Db\File as FileEntity; use OCA\Libresign\Service\PdfParserService; -use OCP\AppFramework\Services\IAppConfig; use OCP\Files\File; +use OCP\IAppConfig; use OCP\IL10N; use OCP\ITempManager; use OCP\IURLGenerator; @@ -46,7 +47,7 @@ public function __construct( public function getFooter(File $file, FileEntity $fileEntity): string { $this->file = $file; $this->fileEntity = $fileEntity; - $add_footer = (bool)$this->appConfig->getAppValue('add_footer', '1'); + $add_footer = (bool)$this->appConfig->getValueBool(Application::APP_ID, 'add_footer', true); if (!$add_footer) { return ''; } @@ -110,12 +111,12 @@ private function getTemplateVars(): array { $this->templateVars['signedBy'] = iconv( 'UTF-8', 'windows-1252', - $this->appConfig->getAppValue('footer_signed_by', $this->l10n->t('Digital signed by LibreSign.')) + $this->appConfig->getValueString(Application::APP_ID, 'footer_signed_by', $this->l10n->t('Digital signed by LibreSign.')) ); - $this->templateVars['linkToSite'] = $this->appConfig->getAppValue('footer_link_to_site', 'https://libresign.coop'); + $this->templateVars['linkToSite'] = $this->appConfig->getValueString(Application::APP_ID, 'footer_link_to_site', 'https://libresign.coop'); - $this->templateVars['validationSite'] = $this->appConfig->getAppValue('validation_site'); + $this->templateVars['validationSite'] = $this->appConfig->getValueString(Application::APP_ID, 'validation_site'); if ($this->templateVars['validationSite']) { $this->templateVars['validationSite'] = rtrim($this->templateVars['validationSite'], '/') . '/' . $this->fileEntity->getUuid(); } else { @@ -124,12 +125,12 @@ private function getTemplateVars(): array { ]); } - $this->templateVars['validateIn'] = $this->appConfig->getAppValue('footer_validate_in', 'Validate in %s.'); + $this->templateVars['validateIn'] = $this->appConfig->getValueString(Application::APP_ID, 'footer_validate_in', 'Validate in %s.'); if ($this->templateVars['validateIn'] === 'Validate in %s.') { $this->templateVars['validateIn'] = $this->l10n->t('Validate in %s.', ['%s']); } - if ($this->appConfig->getAppValue('write_qrcode_on_footer', '1')) { + if ($this->appConfig->getValueBool(Application::APP_ID, 'write_qrcode_on_footer', true)) { $this->templateVars['qrcode'] = $this->getQrCodeImageBase64($this->templateVars['validationSite']); } @@ -137,7 +138,7 @@ private function getTemplateVars(): array { } private function getTemplate(): string { - return $this->appConfig->getAppValue('footer_template', file_get_contents(__DIR__ . '/Templates/footer.php')); + return $this->appConfig->getValueString(Application::APP_ID, 'footer_template', file_get_contents(__DIR__ . '/Templates/footer.php')); } private function getQrCodeImageBase64(string $text): string { diff --git a/lib/Handler/JSignPdfHandler.php b/lib/Handler/JSignPdfHandler.php index 6f5c573824..cd97f679e7 100644 --- a/lib/Handler/JSignPdfHandler.php +++ b/lib/Handler/JSignPdfHandler.php @@ -10,8 +10,9 @@ use Jeidison\JSignPDF\JSignPDF; use Jeidison\JSignPDF\Sign\JSignParam; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Exception\LibresignException; -use OCP\AppFramework\Services\IAppConfig; +use OCP\IAppConfig; use Psr\Log\LoggerInterface; class JSignPdfHandler extends SignEngineHandler { @@ -45,14 +46,14 @@ public function getJSignPdf(): JSignPDF { */ public function getJSignParam(): JSignParam { if (!$this->jSignParam) { - $javaPath = $this->appConfig->getAppValue('java_path'); + $javaPath = $this->appConfig->getValueString(Application::APP_ID, 'java_path'); $this->jSignParam = (new JSignParam()) ->setTempPath( - $this->appConfig->getAppValue('jsignpdf_temp_path', sys_get_temp_dir() . DIRECTORY_SEPARATOR) + $this->appConfig->getValueString(Application::APP_ID, 'jsignpdf_temp_path', sys_get_temp_dir() . DIRECTORY_SEPARATOR) ) ->setIsUseJavaInstalled(empty($javaPath)) ->setjSignPdfJarPath( - $this->appConfig->getAppValue('jsignpdf_jar_path', '/opt/jsignpdf-' . self::VERSION . '/JSignPdf.jar') + $this->appConfig->getValueString(Application::APP_ID, 'jsignpdf_jar_path', '/opt/jsignpdf-' . self::VERSION . '/JSignPdf.jar') ); if (!empty($javaPath)) { if (!file_exists($javaPath)) { @@ -84,7 +85,7 @@ private function getHashAlgorithm(): string { } } - $hashAlgorithm = $this->appConfig->getAppValue('signature_hash_algorithm', 'SHA256'); + $hashAlgorithm = $this->appConfig->getValueString(Application::APP_ID, 'signature_hash_algorithm', 'SHA256'); if (in_array($hashAlgorithm, ['SHA1', 'SHA256', 'SHA384', 'SHA512', 'RIPEMD160'])) { return $hashAlgorithm; } diff --git a/lib/Handler/Pkcs12Handler.php b/lib/Handler/Pkcs12Handler.php index 923de0561f..d027622c1a 100644 --- a/lib/Handler/Pkcs12Handler.php +++ b/lib/Handler/Pkcs12Handler.php @@ -14,9 +14,9 @@ use OCA\Libresign\Exception\LibresignException; use OCA\Libresign\Handler\CertificateEngine\Handler as CertificateEngineHandler; use OCA\Libresign\Service\FolderService; -use OCP\IAppConfig; - use OCP\Files\File; + +use OCP\IAppConfig; use OCP\IL10N; use OCP\ITempManager; use phpseclib3\File\ASN1; diff --git a/lib/Helper/ValidateHelper.php b/lib/Helper/ValidateHelper.php index 823a59314e..b3e605ccd9 100644 --- a/lib/Helper/ValidateHelper.php +++ b/lib/Helper/ValidateHelper.php @@ -10,6 +10,7 @@ use InvalidArgumentException; use OC\AppFramework\Http; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Db\AccountFileMapper; use OCA\Libresign\Db\File; use OCA\Libresign\Db\FileElement; @@ -25,11 +26,11 @@ use OCA\Libresign\Service\FileService; use OCA\Libresign\Service\IdentifyMethodService; use OCP\AppFramework\Db\DoesNotExistException; -use OCP\AppFramework\Services\IAppConfig; use OCP\Files\Config\IUserMountCache; use OCP\Files\IMimeTypeDetector; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; +use OCP\IAppConfig; use OCP\IGroupManager; use OCP\IL10N; use OCP\IUser; @@ -433,7 +434,7 @@ private function getLibreSignFileByNodeId(int $nodeId) { } public function canRequestSign(IUser $user): void { - $authorized = json_decode($this->appConfig->getAppValue('groups_request_sign', '["admin"]'), true); + $authorized = $this->appConfig->getValueArray(Application::APP_ID, 'groups_request_sign', ['admin']); if (empty($authorized)) { $authorized = ['admin']; } @@ -732,7 +733,7 @@ public function userCanApproveValidationDocuments(?IUser $user, bool $throw = tr return false; } - $authorized = json_decode($this->appConfig->getAppValue('approval_group', '["admin"]')); + $authorized = $this->appConfig->getValueArray(Application::APP_ID, 'approval_group', ['admin']); if (!$authorized || !is_array($authorized) || empty($authorized)) { $authorized = ['admin']; } diff --git a/lib/Migration/Version7000Date20221026003343.php b/lib/Migration/Version7000Date20221026003343.php index 292de16d36..c17eb3b2b6 100644 --- a/lib/Migration/Version7000Date20221026003343.php +++ b/lib/Migration/Version7000Date20221026003343.php @@ -8,7 +8,8 @@ namespace OCA\Libresign\Migration; -use OCP\AppFramework\Services\IAppConfig; +use OCA\Libresign\AppInfo\Application; +use OCP\IAppConfig; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; @@ -20,24 +21,24 @@ public function __construct( public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { $rootCert = []; - if ($commonName = $this->appConfig->getAppValue('commonName')) { + if ($commonName = $this->appConfig->getValueString(Application::APP_ID, 'commonName')) { $rootCert['commonName'] = $commonName; - $this->appConfig->deleteAppValue('commonName'); + $this->appConfig->deleteKey(Application::APP_ID, 'commonName'); } - if ($country = $this->appConfig->getAppValue('country')) { + if ($country = $this->appConfig->getValueString(Application::APP_ID, 'country')) { $rootCert['names']['C'] = $country; - $this->appConfig->deleteAppValue('country'); + $this->appConfig->deleteKey(Application::APP_ID, 'country'); } - if ($organization = $this->appConfig->getAppValue('organization')) { + if ($organization = $this->appConfig->getValueString(Application::APP_ID, 'organization')) { $rootCert['names']['O'] = $organization; - $this->appConfig->deleteAppValue('organization'); + $this->appConfig->deleteKey(Application::APP_ID, 'organization'); } - if ($organizationalUnit = $this->appConfig->getAppValue('organizationalUnit')) { + if ($organizationalUnit = $this->appConfig->getValueString(Application::APP_ID, 'organizationalUnit')) { $rootCert['names']['OU'] = $organizationalUnit; - $this->appConfig->deleteAppValue('organizationalUnit'); + $this->appConfig->deleteKey(Application::APP_ID, 'organizationalUnit'); } if ($rootCert) { - $this->appConfig->setAppValue('rootCert', json_encode($rootCert)); + $this->appConfig->setValueArray(Application::APP_ID, 'rootCert', $rootCert); } } } diff --git a/lib/Migration/Version7000Date20221028022904.php b/lib/Migration/Version7000Date20221028022904.php index ce308f2182..a09f6ca87e 100644 --- a/lib/Migration/Version7000Date20221028022904.php +++ b/lib/Migration/Version7000Date20221028022904.php @@ -8,7 +8,8 @@ namespace OCA\Libresign\Migration; -use OCP\AppFramework\Services\IAppConfig; +use OCA\Libresign\AppInfo\Application; +use OCP\IAppConfig; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; @@ -26,8 +27,7 @@ public function __construct( * {"commonName":"Test Company","names":[{"id":"C","value":"BR"},{"id":"O","value":"Organization"},{"id":"OU","value":"Organization Unit"}]} */ public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { - $rootCert = $this->appConfig->getAppValue('rootCert'); - $rootCert = json_decode($rootCert, true); + $rootCert = $this->appConfig->getValueArray(Application::APP_ID, 'rootCert'); if (is_array($rootCert) && array_key_exists('names', $rootCert)) { $names = []; foreach ($rootCert['names'] as $key => $value) { @@ -40,7 +40,7 @@ public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array } if (count($names)) { $rootCert['names'] = $names; - $this->appConfig->setAppValue('rootCert', json_encode($rootCert)); + $this->appConfig->setValueArray(Application::APP_ID, 'rootCert', $rootCert); } } } diff --git a/lib/Migration/Version7000Date20230327094452.php b/lib/Migration/Version7000Date20230327094452.php index 05831587d8..0280e8afa5 100644 --- a/lib/Migration/Version7000Date20230327094452.php +++ b/lib/Migration/Version7000Date20230327094452.php @@ -8,7 +8,8 @@ namespace OCA\Libresign\Migration; -use OCP\AppFramework\Services\IAppConfig; +use OCA\Libresign\AppInfo\Application; +use OCP\IAppConfig; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; @@ -27,8 +28,7 @@ public function __construct( * {"commonName":"Test Company","names":{"C":"BR","O":"Organization","OU":"Organization Unit"}} */ public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { - $rootCert = $this->appConfig->getAppValue('rootCert'); - $rootCert = json_decode($rootCert, true); + $rootCert = $this->appConfig->getValueArray(Application::APP_ID, 'rootCert'); if (is_array($rootCert) && array_key_exists('names', $rootCert)) { $names = []; foreach ($rootCert['names'] as $value) { @@ -40,7 +40,7 @@ public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array } if (count($names)) { $rootCert['names'] = $names; - $this->appConfig->setAppValue('rootCert', json_encode($rootCert)); + $this->appConfig->setValueArray(Application::APP_ID, 'rootCert', $rootCert); } } } diff --git a/lib/Migration/Version8000Date20230410230327.php b/lib/Migration/Version8000Date20230410230327.php index 77fc285294..68411cf44c 100644 --- a/lib/Migration/Version8000Date20230410230327.php +++ b/lib/Migration/Version8000Date20230410230327.php @@ -8,10 +8,11 @@ namespace OCA\Libresign\Migration; -use OCP\AppFramework\Services\IAppConfig; +use OCA\Libresign\AppInfo\Application; use OCP\Files\AppData\IAppDataFactory; use OCP\Files\IAppData; use OCP\Files\NotFoundException; +use OCP\IAppConfig; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; @@ -26,7 +27,7 @@ public function __construct( } public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { - $libresignCliPath = $this->appConfig->getAppValue('libresign_cli_path'); + $libresignCliPath = $this->appConfig->getValueString(Application::APP_ID, 'libresign_cli_path'); if (!$libresignCliPath) { return; } @@ -36,6 +37,6 @@ public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $folder->delete(); } catch (NotFoundException $e) { } - $this->appConfig->deleteAppValue('libresign_cli_path'); + $this->appConfig->deleteKey(Application::APP_ID, 'libresign_cli_path'); } } diff --git a/lib/Migration/Version8000Date20230608004729.php b/lib/Migration/Version8000Date20230608004729.php index 116dfdbff8..2f6770ca2f 100644 --- a/lib/Migration/Version8000Date20230608004729.php +++ b/lib/Migration/Version8000Date20230608004729.php @@ -9,7 +9,8 @@ namespace OCA\Libresign\Migration; use Closure; -use OCP\AppFramework\Services\IAppConfig; +use OCA\Libresign\AppInfo\Application; +use OCP\IAppConfig; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; @@ -20,10 +21,10 @@ public function __construct( } public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { - $cfsslBin = $this->appConfig->getAppValue('cfssl_bin'); - $cfsslUrl = $this->appConfig->getAppValue('cfssl_url'); + $cfsslBin = $this->appConfig->getValueString(Application::APP_ID, 'cfssl_bin'); + $cfsslUrl = $this->appConfig->getValueString(Application::APP_ID, 'cfssl_url'); if ($cfsslBin || $cfsslUrl) { - $this->appConfig->setAppValue('certificate_engine', 'cfssl'); + $this->appConfig->setValueString(Application::APP_ID, 'certificate_engine', 'cfssl'); } } } diff --git a/lib/Migration/Version8000Date20230730032402.php b/lib/Migration/Version8000Date20230730032402.php index bb5363d164..3fda983a27 100644 --- a/lib/Migration/Version8000Date20230730032402.php +++ b/lib/Migration/Version8000Date20230730032402.php @@ -9,8 +9,9 @@ namespace OCA\Libresign\Migration; use Closure; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Service\Install\InstallService; -use OCP\AppFramework\Services\IAppConfig; +use OCP\IAppConfig; use OCP\Migration\IOutput; use OCP\Migration\SimpleMigrationStep; @@ -23,13 +24,13 @@ public function __construct( public function preSchemaChange(IOutput $output, Closure $schemaClosure, array $options): void { $this->installService->installPdftk(); - if ($rootCert = $this->appConfig->getAppValue('rootCert')) { - $this->appConfig->deleteAppValue('rootCert'); - $this->appConfig->setAppValue('root_cert', $rootCert); + if ($rootCert = $this->appConfig->getValueArray(Application::APP_ID, 'rootCert')) { + $this->appConfig->deleteKey(Application::APP_ID, 'rootCert'); + $this->appConfig->setValueArray(Application::APP_ID, 'root_cert', $rootCert); } - if ($notifyUnsignedUser = $this->appConfig->getAppValue('notifyUnsignedUser', '')) { - $this->appConfig->setAppValue('notify_unsigned_user', $notifyUnsignedUser); + if ($notifyUnsignedUser = $this->appConfig->getValueString(Application::APP_ID, 'notifyUnsignedUser', '')) { + $this->appConfig->setValueString(Application::APP_ID, 'notify_unsigned_user', $notifyUnsignedUser); } - $this->appConfig->deleteAppValue('notifyUnsignedUser'); + $this->appConfig->deleteKey(Application::APP_ID, 'notifyUnsignedUser'); } } diff --git a/lib/Service/AccountFileService.php b/lib/Service/AccountFileService.php index 3960195500..d785601886 100644 --- a/lib/Service/AccountFileService.php +++ b/lib/Service/AccountFileService.php @@ -8,11 +8,12 @@ namespace OCA\Libresign\Service; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Db\AccountFile; use OCA\Libresign\Db\AccountFileMapper; use OCA\Libresign\Db\File; use OCA\Libresign\ResponseDefinitions; -use OCP\AppFramework\Services\IAppConfig; +use OCP\IAppConfig; use OCP\IUser; /** @@ -47,7 +48,7 @@ public function deleteFile(int $fileId, string $uid): void { */ public function accountFileList(array $filter, ?int $page = null, ?int $length = null): array { $page = $page ?? 1; - $length = $length ?? (int)$this->appConfig->getAppValue('length_of_page', '100'); + $length = $length ?? (int)$this->appConfig->getValueInt(Application::APP_ID, 'length_of_page', 100); $data = $this->accountFileMapper->accountFileList($filter, $page, $length); $data['pagination']->setRouteName('ocs.libresign.File.list'); return [ diff --git a/lib/Service/AccountService.php b/lib/Service/AccountService.php index c28c289922..82724c3ab7 100644 --- a/lib/Service/AccountService.php +++ b/lib/Service/AccountService.php @@ -10,6 +10,7 @@ use InvalidArgumentException; use OC\Files\Filesystem; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Db\AccountFileMapper; use OCA\Libresign\Db\File as FileEntity; use OCA\Libresign\Db\FileMapper; @@ -26,7 +27,6 @@ use OCA\Settings\Mailer\NewUserMailHelper; use OCP\Accounts\IAccountManager; use OCP\AppFramework\Db\DoesNotExistException; -use OCP\AppFramework\Services\IAppConfig; use OCP\AppFramework\Utility\ITimeFactory; use OCP\Files\Config\IMountProviderCollection; use OCP\Files\Config\IUserMountCache; @@ -36,6 +36,7 @@ use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; use OCP\Http\Client\IClientService; +use OCP\IAppConfig; use OCP\IConfig; use OCP\IGroupManager; use OCP\IL10N; @@ -235,7 +236,7 @@ public function getCertificateEngineName(): string { * @return array[] */ public function getConfig(?IUser $user = null): array { - $info['identificationDocumentsFlow'] = $this->appConfig->getAppValue('identification_documents') ? true : false; + $info['identificationDocumentsFlow'] = $this->appConfig->getValueBool(Application::APP_ID, 'identification_documents', false); $info['hasSignatureFile'] = $this->hasSignatureFile($user); $info['phoneNumber'] = $this->getPhoneNumber($user); $info['isApprover'] = $this->validateHelper->userCanApproveValidationDocuments($user, false); @@ -312,7 +313,7 @@ public function canRequestSign(?IUser $user = null): bool { if (!$user) { return false; } - $authorized = json_decode($this->appConfig->getAppValue('groups_request_sign', '["admin"]')); + $authorized = $this->appConfig->getValueArray(Application::APP_ID, 'groups_request_sign', ['admin']); if (empty($authorized)) { return false; } diff --git a/lib/Service/FolderService.php b/lib/Service/FolderService.php index 0b459ce3dc..5c1a52c9f5 100644 --- a/lib/Service/FolderService.php +++ b/lib/Service/FolderService.php @@ -134,7 +134,7 @@ private function getLibreSignDefaultPath(): string { $path = $this->appConfig->getUserValue($this->userId, 'folder'); if (empty($path)) { - $defaultFolder = $this->appConfig->getAppValue('default_user_folder', 'LibreSign'); + $defaultFolder = $this->appConfig->getAppValueString('default_user_folder', 'LibreSign'); $path = '/' . $defaultFolder; $this->appConfig->setUserValue($this->userId, 'folder', $path); } diff --git a/lib/Service/IdentifyMethod/AbstractIdentifyMethod.php b/lib/Service/IdentifyMethod/AbstractIdentifyMethod.php index a3c4bada55..6b69486283 100644 --- a/lib/Service/IdentifyMethod/AbstractIdentifyMethod.php +++ b/lib/Service/IdentifyMethod/AbstractIdentifyMethod.php @@ -9,6 +9,7 @@ namespace OCA\Libresign\Service\IdentifyMethod; use InvalidArgumentException; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Db\File as FileEntity; use OCA\Libresign\Db\IdentifyMethod; use OCA\Libresign\Events\SendSignNotificationEvent; @@ -157,7 +158,7 @@ protected function throwIfFileNotFound(): void { } protected function throwIfMaximumValidityExpired(): void { - $maximumValidity = (int)$this->identifyService->getAppConfig()->getAppValue('maximum_validity', (string)SessionService::NO_MAXIMUM_VALIDITY); + $maximumValidity = (int)$this->identifyService->getAppConfig()->setValueInt(Application::APP_ID, 'maximum_validity', SessionService::NO_MAXIMUM_VALIDITY); if ($maximumValidity <= 0) { return; } @@ -182,7 +183,7 @@ protected function throwIfInvalidToken(): void { protected function renewSession(): void { $this->identifyService->getSessionService()->setIdentifyMethodId($this->getEntity()->getId()); - $renewalInterval = (int)$this->identifyService->getAppConfig()->getAppValue('renewal_interval', (string)SessionService::NO_RENEWAL_INTERVAL); + $renewalInterval = (int)$this->identifyService->getAppConfig()->setValueInt(Application::APP_ID, 'renewal_interval', SessionService::NO_RENEWAL_INTERVAL); if ($renewalInterval <= 0) { return; } @@ -200,7 +201,7 @@ protected function updateIdentifiedAt(): void { } protected function throwIfRenewalIntervalExpired(): void { - $renewalInterval = (int)$this->identifyService->getAppConfig()->getAppValue('renewal_interval', (string)SessionService::NO_RENEWAL_INTERVAL); + $renewalInterval = (int)$this->identifyService->getAppConfig()->setValueInt(Application::APP_ID, 'renewal_interval', SessionService::NO_RENEWAL_INTERVAL); if ($renewalInterval <= 0) { return; } diff --git a/lib/Service/IdentifyMethod/Account.php b/lib/Service/IdentifyMethod/Account.php index 770fe4fa38..f5cebc1c48 100644 --- a/lib/Service/IdentifyMethod/Account.php +++ b/lib/Service/IdentifyMethod/Account.php @@ -8,6 +8,7 @@ namespace OCA\Libresign\Service\IdentifyMethod; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Db\IdentifyMethodMapper; use OCA\Libresign\Exception\LibresignException; use OCA\Libresign\Helper\JSActions; @@ -126,8 +127,7 @@ public function getSettings(): array { } private function isEnabledByDefault(): bool { - $config = $this->identifyService->getAppConfig()->getAppValue('identify_methods', '[]'); - $config = json_decode($config, true); + $config = $this->identifyService->getAppConfig()->getValueArray(Application::APP_ID, 'identify_methods', []); if (json_last_error() !== JSON_ERROR_NONE || !is_array($config)) { return true; } diff --git a/lib/Service/IdentifyMethod/IdentifyService.php b/lib/Service/IdentifyMethod/IdentifyService.php index f8b3932533..20170d276b 100644 --- a/lib/Service/IdentifyMethod/IdentifyService.php +++ b/lib/Service/IdentifyMethod/IdentifyService.php @@ -8,16 +8,17 @@ namespace OCA\Libresign\Service\IdentifyMethod; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Db\FileMapper; use OCA\Libresign\Db\IdentifyMethod; use OCA\Libresign\Db\IdentifyMethodMapper; use OCA\Libresign\Db\SignRequestMapper; use OCA\Libresign\Service\SessionService; -use OCP\AppFramework\Services\IAppConfig; use OCP\AppFramework\Utility\ITimeFactory; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Config\IUserMountCache; use OCP\Files\IRootFolder; +use OCP\IAppConfig; use OCP\IL10N; use OCP\IURLGenerator; use OCP\IUserManager; @@ -83,12 +84,7 @@ public function getSavedSettings(): array { if (!empty($this->savedSettings)) { return $this->savedSettings; } - $config = $this->getAppConfig()->getAppValue('identify_methods', '[]'); - $config = json_decode($config, true); - if (is_array($config)) { - $this->savedSettings = $config; - } - return $this->savedSettings; + return $this->getAppConfig()->getValueArray(Application::APP_ID, 'identify_methods', []); } public function getEventDispatcher(): IEventDispatcher { diff --git a/lib/Service/Install/ConfigureCheckService.php b/lib/Service/Install/ConfigureCheckService.php index d6186e4fd0..2e3f702429 100644 --- a/lib/Service/Install/ConfigureCheckService.php +++ b/lib/Service/Install/ConfigureCheckService.php @@ -10,10 +10,11 @@ use OC\AppConfig; use OC\SystemConfig; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Handler\CertificateEngine\Handler as CertificateEngine; use OCA\Libresign\Handler\JSignPdfHandler; use OCA\Libresign\Helper\ConfigureCheckHelper; -use OCP\AppFramework\Services\IAppConfig; +use OCP\IAppConfig; use Psr\Log\LoggerInterface; class ConfigureCheckService { @@ -105,7 +106,7 @@ public function checkPoppler(): array { * @return ConfigureCheckHelper[] */ public function checkJSignPdf(): array { - $jsignpdJarPath = $this->appConfig->getAppValue('jsignpdf_jar_path'); + $jsignpdJarPath = $this->appConfig->getValueString(Application::APP_ID, 'jsignpdf_jar_path'); if ($jsignpdJarPath) { $resultOfVerify = $this->verify('jsignpdf'); if (count($resultOfVerify)) { @@ -175,7 +176,7 @@ public function checkJSignPdf(): array { * @return ConfigureCheckHelper[] */ public function checkPdftk(): array { - $pdftkPath = $this->appConfig->getAppValue('pdftk_path'); + $pdftkPath = $this->appConfig->getValueString(Application::APP_ID, 'pdftk_path'); if ($pdftkPath) { $resultOfVerify = $this->verify('pdftk'); if (count($resultOfVerify)) { @@ -196,7 +197,7 @@ public function checkPdftk(): array { ->setTip('Run occ libresign:install --java'), ]; } - $javaPath = $this->appConfig->getAppValue('java_path'); + $javaPath = $this->appConfig->getValueString(Application::APP_ID, 'java_path'); $version = []; \exec($javaPath . ' -jar ' . $pdftkPath . ' --version 2>&1', $version, $resultCode); if ($resultCode !== 0) { @@ -294,7 +295,7 @@ private function getErrorAndTipToResultOfVerify(array $result): array { * @return ConfigureCheckHelper[] */ private function checkJava(): array { - $javaPath = $this->appConfig->getAppValue('java_path'); + $javaPath = $this->appConfig->getValueString(Application::APP_ID, 'java_path'); if ($javaPath) { $resultOfVerify = $this->verify('java'); if (count($resultOfVerify)) { diff --git a/lib/Service/Install/InstallService.php b/lib/Service/Install/InstallService.php index 4c6de3659a..0931c7d16a 100644 --- a/lib/Service/Install/InstallService.php +++ b/lib/Service/Install/InstallService.php @@ -21,7 +21,6 @@ use OCA\Libresign\Handler\CertificateEngine\Handler as CertificateEngineHandler; use OCA\Libresign\Handler\CertificateEngine\IEngineHandler; use OCA\Libresign\Handler\JSignPdfHandler; -use OCP\AppFramework\Services\IAppConfig; use OCP\Files\AppData\IAppDataFactory; use OCP\Files\IAppData; use OCP\Files\IRootFolder; @@ -30,6 +29,7 @@ use OCP\Files\SimpleFS\ISimpleFile; use OCP\Files\SimpleFS\ISimpleFolder; use OCP\Http\Client\IClientService; +use OCP\IAppConfig; use OCP\ICache; use OCP\ICacheFactory; use OCP\IConfig; @@ -421,7 +421,7 @@ public function installJava(?bool $async = false): void { $downloadOk = true; } - $this->appConfig->setAppValue('java_path', $extractDir . '/jdk-' . self::JAVA_URL_PATH_NAME . '-jre/bin/java'); + $this->appConfig->setValueString(Application::APP_ID, 'java_path', $extractDir . '/jdk-' . self::JAVA_URL_PATH_NAME . '-jre/bin/java'); if ($downloadOk) { $this->writeAppSignature(); } @@ -435,16 +435,16 @@ public function setDistro(string $distro): void { public function getInstallPath(): string { switch ($this->resource) { case 'java': - $path = $this->appConfig->getAppValue('java_path'); + $path = $this->appConfig->getValueString(Application::APP_ID, 'java_path'); return substr($path, 0, -strlen('/bin/java')); case 'jsignpdf': - $path = $this->appConfig->getAppValue('jsignpdf_jar_path'); + $path = $this->appConfig->getValueString(Application::APP_ID, 'jsignpdf_jar_path'); return substr($path, 0, -strlen('/JSignPdf.jar')); case 'pdftk': - $path = $this->appConfig->getAppValue('pdftk_path'); + $path = $this->appConfig->getValueString(Application::APP_ID, 'pdftk_path'); return substr($path, 0, -strlen('/pdftk.jar')); case 'cfssl': - $path = $this->appConfig->getAppValue('cfssl_bin'); + $path = $this->appConfig->getValueString(Application::APP_ID, 'cfssl_bin'); return substr($path, 0, -strlen('/cfssl')); } return ''; @@ -466,7 +466,7 @@ public function getLinuxDistributionToDownloadJava(): string { } public function uninstallJava(): void { - $javaPath = $this->appConfig->getAppValue('java_path'); + $javaPath = $this->appConfig->getValueString(Application::APP_ID, 'java_path'); if (!$javaPath) { return; } @@ -476,7 +476,7 @@ public function uninstallJava(): void { $folder->delete(); } catch (NotFoundException $th) { } - $this->appConfig->deleteAppValue('java_path'); + $this->appConfig->deleteKey(Application::APP_ID, 'java_path'); } public function installJSignPdf(?bool $async = false): void { @@ -513,7 +513,7 @@ public function installJSignPdf(?bool $async = false): void { } $fullPath = $extractDir . '/jsignpdf-' . JSignPdfHandler::VERSION . '/JSignPdf.jar'; - $this->appConfig->setAppValue('jsignpdf_jar_path', $fullPath); + $this->appConfig->setValueString(Application::APP_ID, 'jsignpdf_jar_path', $fullPath); if ($downloadOk) { $this->writeAppSignature(); } @@ -521,7 +521,7 @@ public function installJSignPdf(?bool $async = false): void { } public function uninstallJSignPdf(): void { - $jsignpdJarPath = $this->appConfig->getAppValue('jsignpdf_jar_path'); + $jsignpdJarPath = $this->appConfig->getValueString(Application::APP_ID, 'jsignpdf_jar_path'); if (!$jsignpdJarPath) { return; } @@ -531,7 +531,7 @@ public function uninstallJSignPdf(): void { $folder->delete(); } catch (NotFoundException $e) { } - $this->appConfig->deleteAppValue('jsignpdf_jar_path'); + $this->appConfig->deleteKey(Application::APP_ID, 'jsignpdf_jar_path'); } public function installPdftk(?bool $async = false): void { @@ -561,7 +561,7 @@ public function installPdftk(?bool $async = false): void { $this->download($url, 'pdftk', $fullPath, $hash); } - $this->appConfig->setAppValue('pdftk_path', $fullPath); + $this->appConfig->setValueString(Application::APP_ID, 'pdftk_path', $fullPath); if ($downloadOk) { $this->writeAppSignature(); } @@ -569,7 +569,7 @@ public function installPdftk(?bool $async = false): void { } public function uninstallPdftk(): void { - $jsignpdJarPath = $this->appConfig->getAppValue('pdftk_path'); + $jsignpdJarPath = $this->appConfig->getValueString(Application::APP_ID, 'pdftk_path'); if (!$jsignpdJarPath) { return; } @@ -579,7 +579,7 @@ public function uninstallPdftk(): void { $folder->delete(); } catch (NotFoundException $e) { } - $this->appConfig->deleteAppValue('pdftk_path'); + $this->appConfig->deleteKey(Application::APP_ID, 'pdftk_path'); } public function installCfssl(?bool $async = false): void { @@ -635,14 +635,14 @@ private function installCfsslByArchitecture(string $architecture): void { $cfsslBinPath = $this->getDataDir() . '/' . $this->getInternalPathOfFolder($folder) . '/cfssl'; - $this->appConfig->setAppValue('cfssl_bin', $cfsslBinPath); + $this->appConfig->setValueString(Application::APP_ID, 'cfssl_bin', $cfsslBinPath); if ($downloadOk) { $this->writeAppSignature(); } } public function uninstallCfssl(): void { - $cfsslPath = $this->appConfig->getAppValue('cfssl_bin'); + $cfsslPath = $this->appConfig->getValueString(Application::APP_ID, 'cfssl_bin'); if (!$cfsslPath) { return; } @@ -652,11 +652,11 @@ public function uninstallCfssl(): void { $folder->delete(); } catch (NotFoundException $e) { } - $this->appConfig->deleteAppValue('cfssl_bin'); + $this->appConfig->deleteKey(Application::APP_ID, 'cfssl_bin'); } public function isCfsslBinInstalled(): bool { - if ($this->appConfig->getAppValue('cfssl_bin')) { + if ($this->appConfig->getValueString(Application::APP_ID, 'cfssl_bin')) { return true; } return false; @@ -761,12 +761,12 @@ public function generate( $names ); - $this->appConfig->setAppValue('root_cert', json_encode($rootCert)); - $this->appConfig->setAppValue('authkey', $privateKey); + $this->appConfig->setValueArray(Application::APP_ID, 'root_cert', $rootCert); + $this->appConfig->setValueString(Application::APP_ID, 'authkey', $privateKey); /** @var AEngineHandler $engine */ if ($engine->getEngine() === 'cfssl') { - $this->appConfig->setAppValue('config_path', $engine->getConfigPath()); + $this->appConfig->setValueString(Application::APP_ID, 'config_path', $engine->getConfigPath()); } - $this->appConfig->setAppValue('notify_unsigned_user', '1'); + $this->appConfig->setValueBool(Application::APP_ID, 'notify_unsigned_user', true); } } diff --git a/lib/Service/Install/SignSetupService.php b/lib/Service/Install/SignSetupService.php index c67c17e906..52a7e05912 100644 --- a/lib/Service/Install/SignSetupService.php +++ b/lib/Service/Install/SignSetupService.php @@ -16,8 +16,8 @@ use OCA\Libresign\Exception\InvalidSignatureException; use OCA\Libresign\Exception\SignatureDataNotFoundException; use OCP\App\IAppManager; -use OCP\AppFramework\Services\IAppConfig; use OCP\Files\NotFoundException; +use OCP\IAppConfig; use OCP\IConfig; use phpseclib\Crypt\RSA; use phpseclib\File\X509; @@ -139,7 +139,7 @@ public function writeAppSignature() { public function getInstallPath(): string { switch ($this->resource) { case 'java': - $path = $this->appConfig->getAppValue('java_path'); + $path = $this->appConfig->getValueString(Application::APP_ID, 'java_path'); $installPath = substr($path, 0, -strlen('/bin/java')); $distro = $this->getLinuxDistributionToDownloadJava(); $expected = "{$this->instanceId}/libresign/{$this->architecture}/{$distro}/java"; @@ -152,15 +152,15 @@ public function getInstallPath(): string { } break; case 'jsignpdf': - $path = $this->appConfig->getAppValue('jsignpdf_jar_path'); + $path = $this->appConfig->getValueString(Application::APP_ID, 'jsignpdf_jar_path'); $installPath = substr($path, 0, strrpos($path, '/', -strlen('_/JSignPdf.jar'))); break; case 'pdftk': - $path = $this->appConfig->getAppValue('pdftk_path'); + $path = $this->appConfig->getValueString(Application::APP_ID, 'pdftk_path'); $installPath = substr($path, 0, -strlen('/pdftk.jar')); break; case 'cfssl': - $path = $this->appConfig->getAppValue('cfssl_bin'); + $path = $this->appConfig->getValueString(Application::APP_ID, 'cfssl_bin'); $installPath = substr($path, 0, -strlen('/cfssl')); break; default: diff --git a/lib/Service/MailService.php b/lib/Service/MailService.php index 2b5087abac..592af8a74d 100644 --- a/lib/Service/MailService.php +++ b/lib/Service/MailService.php @@ -8,11 +8,12 @@ namespace OCA\Libresign\Service; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Db\File; use OCA\Libresign\Db\FileMapper; use OCA\Libresign\Db\SignRequest; use OCA\Libresign\Exception\LibresignException; -use OCP\AppFramework\Services\IAppConfig; +use OCP\IAppConfig; use OCP\IL10N; use OCP\IURLGenerator; use OCP\Mail\IMailer; @@ -76,7 +77,7 @@ public function notifySignDataUpdated(SignRequest $data, string $email): void { * @psalm-suppress MixedMethodCall */ public function notifyUnsignedUser(SignRequest $data, string $email): void { - $notifyUnsignedUser = (bool)$this->appConfig->getAppValue('notify_unsigned_user', '1'); + $notifyUnsignedUser = $this->appConfig->getValueBool(Application::APP_ID, 'notify_unsigned_user', true); if (!$notifyUnsignedUser) { return; } diff --git a/lib/Service/SessionService.php b/lib/Service/SessionService.php index 79d1a7e9d1..9fbf4e5765 100644 --- a/lib/Service/SessionService.php +++ b/lib/Service/SessionService.php @@ -8,7 +8,8 @@ namespace OCA\Libresign\Service; -use OCP\AppFramework\Services\IAppConfig; +use OCA\Libresign\AppInfo\Application; +use OCP\IAppConfig; use OCP\ISession; class SessionService { @@ -39,7 +40,7 @@ public function getIdentifyMethodId(): ?int { } public function resetDurationOfSignPage(): void { - $renewalInterval = (int)$this->appConfig->getAppValue('renewal_interval', (string)self::NO_RENEWAL_INTERVAL); + $renewalInterval = $this->appConfig->setValueInt(Application::APP_ID, 'renewal_interval', self::NO_RENEWAL_INTERVAL); if ($renewalInterval <= self::NO_RENEWAL_INTERVAL) { return; } diff --git a/lib/Service/SignFileService.php b/lib/Service/SignFileService.php index 60aa2abe05..4a4c431f3a 100644 --- a/lib/Service/SignFileService.php +++ b/lib/Service/SignFileService.php @@ -11,6 +11,7 @@ use InvalidArgumentException; use mikehaertl\pdftk\Command; use OC\AppFramework\Http as AppFrameworkHttp; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\DataObjects\VisibleElementAssoc; use OCA\Libresign\Db\AccountFile; use OCA\Libresign\Db\AccountFileMapper; @@ -34,7 +35,6 @@ use OCA\Libresign\Service\IdentifyMethod\IIdentifyMethod; use OCA\Libresign\Service\IdentifyMethod\SignatureMethod\EmailToken; use OCP\AppFramework\Db\DoesNotExistException; -use OCP\AppFramework\Services\IAppConfig; use OCP\AppFramework\Utility\ITimeFactory; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Config\IUserMountCache; @@ -43,6 +43,7 @@ use OCP\Files\Node; use OCP\Files\NotPermittedException; use OCP\Http\Client\IClientService; +use OCP\IAppConfig; use OCP\IL10N; use OCP\ITempManager; use OCP\IURLGenerator; @@ -135,7 +136,7 @@ public function canDeleteRequestSignature(array $data): void { public function notifyCallback(File $file): void { $uri = $this->libreSignFile->getCallback(); if (!$uri) { - $uri = $this->appConfig->getAppValue('webhook_sign_url'); + $uri = $this->appConfig->getValueString(Application::APP_ID, 'webhook_sign_url'); if (!$uri) { return; } @@ -295,7 +296,7 @@ public function sign(): File { } public function storeUserMetadata(array $metadata = []): self { - $collectMetadata = $this->appConfig->getAppValue('collect_metadata') ? true : false; + $collectMetadata = $this->appConfig->getValueBool(Application::APP_ID, 'collect_metadata', false); if (!$collectMetadata || !$metadata) { return $this; } @@ -548,8 +549,8 @@ private function getPdfToSign(FileEntity $fileData, File $originalFile): File { $input = $this->tempManager->getTemporaryFile('input.pdf'); file_put_contents($input, $originalFile->getContent()); - $javaPath = $this->appConfig->getAppValue('java_path'); - $pdftkPath = $this->appConfig->getAppValue('pdftk_path'); + $javaPath = $this->appConfig->getValueString(Application::APP_ID, 'java_path'); + $pdftkPath = $this->appConfig->getValueString(Application::APP_ID, 'pdftk_path'); if (!file_exists($javaPath) || !file_exists($pdftkPath)) { throw new LibresignException($this->l10n->t('The admin hasn\'t set up LibreSign yet, please wait.')); } diff --git a/lib/Settings/Admin.php b/lib/Settings/Admin.php index 5d7fda1189..8349810049 100644 --- a/lib/Settings/Admin.php +++ b/lib/Settings/Admin.php @@ -12,8 +12,8 @@ use OCA\Libresign\Handler\CertificateEngine\Handler as CertificateEngineHandler; use OCA\Libresign\Service\IdentifyMethodService; use OCP\AppFramework\Http\TemplateResponse; -use OCP\AppFramework\Services\IAppConfig; use OCP\AppFramework\Services\IInitialState; +use OCP\IAppConfig; use OCP\Settings\ISettings; use OCP\Util; @@ -37,7 +37,7 @@ public function getForm(): TemplateResponse { ); $this->initialState->provideInitialState( 'config_path', - $this->appConfig->getAppValue('config_path') + $this->appConfig->getValueString(Application::APP_ID, 'config_path') ); return new TemplateResponse(Application::APP_ID, 'admin_settings'); } diff --git a/src/views/Settings/Validation.vue b/src/views/Settings/Validation.vue index 5e293344f6..de2d5bdca0 100644 --- a/src/views/Settings/Validation.vue +++ b/src/views/Settings/Validation.vue @@ -96,7 +96,7 @@ export default { const response = await axios.get( generateOcsUrl('/apps/provisioning_api/api/v1/config/apps/libresign/make_validation_url_private'), ) - this.makeValidationUrlPrivate = response.data.ocs.data.data === '1' + this.makeValidationUrlPrivate = response.data.ocs.data.data === true }, async getAddFooterData() { const response = await axios.get( @@ -126,7 +126,7 @@ export default { OCP.AppConfig.setValue('libresign', 'validation_site', this.$refs.urlInput.value.trim()) }, async toggleSetting(setting, value) { - OCP.AppConfig.setValue('libresign', setting, value ? 1 : 0) + OCP.AppConfig.setValue('libresign', setting, value ? true : false) }, placeHolderValidationUrl(data) { if (data !== '') { diff --git a/tests/Unit/Handler/FooterHandlerTest.php b/tests/Unit/Handler/FooterHandlerTest.php index d9297eb1f1..f590e16478 100644 --- a/tests/Unit/Handler/FooterHandlerTest.php +++ b/tests/Unit/Handler/FooterHandlerTest.php @@ -8,7 +8,7 @@ use OCA\Libresign\Handler\FooterHandler; use OCA\Libresign\Service\PdfParserService; -use OCP\AppFramework\Services\IAppConfig; +use OCP\IAppConfig; use OCP\IL10N; use OCP\ITempManager; use OCP\IURLGenerator; @@ -48,7 +48,7 @@ private function getClass(): FooterHandler { public function testGetFooterWithoutValidationSite(): void { $this->appConfig = $this->createMock(IAppConfig::class); $this->appConfig - ->method('getAppValue') + ->method('getValueString') ->willReturn(''); $file = $this->createMock(\OCP\Files\File::class); $libresignFile = $this->createMock(\OCA\Libresign\Db\File::class); @@ -60,7 +60,7 @@ public function testGetFooterWithoutValidationSite(): void { public function testGetFooterWithSuccess(array $settings, array $expected): void { $this->appConfig = $this->createMock(IAppConfig::class); $this->appConfig - ->method('getAppValue') + ->method('getValueString') ->willReturnCallback(function ($key, $default) use ($settings):string { if (array_key_exists($key, $settings)) { return $settings[$key]; @@ -108,13 +108,13 @@ public function testGetFooterWithSuccess(array $settings, array $expected): void public static function dataGetFooterWithSuccess(): array { return [ [ - ['add_footer' => '0',], [] + ['add_footer' => false,], [] ], [ [ - 'add_footer' => '1', + 'add_footer' => true, 'validation_site' => 'http://test.coop', - 'write_qrcode_on_footer' => '1', + 'write_qrcode_on_footer' => true, 'footer_link_to_site' => 'https://libresign.coop', 'footer_signed_by' => 'Digital signed by LibreSign.', 'footer_validate_in' => 'Validate in %s.', @@ -138,7 +138,7 @@ public static function dataGetFooterWithSuccess(): array { ], [ [ - 'add_footer' => '1', + 'add_footer' => true, 'validation_site' => 'http://test.coop', 'write_qrcode_on_footer' => '0', 'footer_link_to_site' => 'https://libresign.coop', diff --git a/tests/Unit/Handler/JSignPdfHandlerTest.php b/tests/Unit/Handler/JSignPdfHandlerTest.php index ab1af4cb56..496d6a5ad7 100644 --- a/tests/Unit/Handler/JSignPdfHandlerTest.php +++ b/tests/Unit/Handler/JSignPdfHandlerTest.php @@ -10,7 +10,7 @@ use Jeidison\JSignPDF\JSignPDF; use OCA\Libresign\Handler\JSignPdfHandler; -use OCP\AppFramework\Services\IAppConfig; +use OCP\IAppConfig; use PHPUnit\Framework\MockObject\MockObject; use Psr\Log\LoggerInterface; diff --git a/tests/Unit/Handler/OpenSslHandlerTest.php b/tests/Unit/Handler/OpenSslHandlerTest.php index 241561e603..4c20b169a4 100644 --- a/tests/Unit/Handler/OpenSslHandlerTest.php +++ b/tests/Unit/Handler/OpenSslHandlerTest.php @@ -8,8 +8,8 @@ use bovigo\vfs\vfsStream; use OCA\Libresign\Handler\CertificateEngine\OpenSslHandler; -use OCP\AppFramework\Services\IAppConfig; use OCP\Files\AppData\IAppDataFactory; +use OCP\IAppConfig; use OCP\IConfig; use OCP\IDateTimeFormatter; use OCP\ITempManager; diff --git a/tests/Unit/Helper/ValidateHelperTest.php b/tests/Unit/Helper/ValidateHelperTest.php index d1d538ab02..553c756d52 100644 --- a/tests/Unit/Helper/ValidateHelperTest.php +++ b/tests/Unit/Helper/ValidateHelperTest.php @@ -19,10 +19,10 @@ use OCA\Libresign\Exception\LibresignException; use OCA\Libresign\Helper\ValidateHelper; use OCA\Libresign\Service\IdentifyMethodService; -use OCP\AppFramework\Services\IAppConfig; use OCP\Files\Config\IUserMountCache; use OCP\Files\IMimeTypeDetector; use OCP\Files\IRootFolder; +use OCP\IAppConfig; use OCP\IGroupManager; use OCP\IL10N; use OCP\IUser; @@ -218,7 +218,7 @@ public function testCanRequestSignWithoutUserManager():void { $this->expectExceptionMessage('You are not allowed to request signing'); $this->appConfig - ->method('getAppValue') + ->method('getValueString') ->willReturn(''); $user = $this->createMock(\OCP\IUser::class); $this->getValidateHelper()->canRequestSign($user); @@ -229,7 +229,7 @@ public function testCanRequestSignWithoutPermission():void { $this->appConfig = $this->createMock(IAppConfig::class); $this->appConfig - ->method('getAppValue') + ->method('getValueString') ->willReturn('["admin"]'); $this->groupManager ->method('getUserGroupIds') diff --git a/tests/Unit/Service/AccountFileServiceTest.php b/tests/Unit/Service/AccountFileServiceTest.php index 2b43e6cbfa..3795de9b40 100644 --- a/tests/Unit/Service/AccountFileServiceTest.php +++ b/tests/Unit/Service/AccountFileServiceTest.php @@ -11,7 +11,7 @@ use OCA\Libresign\Db\AccountFileMapper; use OCA\Libresign\Db\File; use OCA\Libresign\Service\AccountFileService; -use OCP\AppFramework\Services\IAppConfig; +use OCP\IAppConfig; use OCP\IUser; use PHPUnit\Framework\MockObject\MockObject; diff --git a/tests/Unit/Service/AccountServiceTest.php b/tests/Unit/Service/AccountServiceTest.php index b8570bece3..0990b15ae9 100644 --- a/tests/Unit/Service/AccountServiceTest.php +++ b/tests/Unit/Service/AccountServiceTest.php @@ -28,11 +28,11 @@ use OCA\Libresign\Service\SignFileService; use OCA\Settings\Mailer\NewUserMailHelper; use OCP\Accounts\IAccountManager; -use OCP\AppFramework\Services\IAppConfig; use OCP\Files\Config\IMountProviderCollection; use OCP\Files\Config\IUserMountCache; use OCP\Files\IMimeTypeDetector; use OCP\Files\IRootFolder; +use OCP\IAppConfig; use OCP\IConfig; use OCP\IGroupManager; use OCP\IL10N; @@ -354,7 +354,7 @@ public function testCreateToSignWithErrorInSendingEmail():void { $this->signRequestMapper->method('getByUuid')->will($this->returnValue($signRequest)); $userToSign = $this->createMock(\OCP\IUser::class); $this->userManager->method('createUser')->will($this->returnValue($userToSign)); - $this->config->method('getAppValue')->will($this->returnValue('yes')); + $this->config->method('getValueBool')->will($this->returnValue(true)); $template = $this->createMock(\OCP\Mail\IEMailTemplate::class); $this->newUserMail->method('generateTemplate')->will($this->returnValue($template)); $this->newUserMail->method('sendMail')->will($this->returnCallback(function ():void { @@ -405,7 +405,7 @@ public function testCanRequestSignWithUnexistentUser():void { public function testCanRequestSignWithoutGroups():void { $this->appConfig - ->method('getAppValue') + ->method('getValueString') ->willReturn(''); $user = $this->createMock(\OCP\IUser::class); $actual = $this->getService()->canRequestSign($user); @@ -414,8 +414,8 @@ public function testCanRequestSignWithoutGroups():void { public function testCanRequestSignWithUserOutOfAuthorizedGroups():void { $this->appConfig - ->method('getAppValue') - ->willReturn('["admin"]'); + ->method('getValueArray') + ->willReturn(['admin']); $this->groupManager ->method('getUserGroupIds') ->willReturn([]); @@ -426,8 +426,8 @@ public function testCanRequestSignWithUserOutOfAuthorizedGroups():void { public function testCanRequestSignWithSuccess():void { $this->appConfig - ->method('getAppValue') - ->willReturn('["admin"]'); + ->method('getValueArray') + ->willReturn(['admin']); $this->groupManager ->method('getUserGroupIds') ->willReturn(['admin']); diff --git a/tests/Unit/Service/FolderServiceTest.php b/tests/Unit/Service/FolderServiceTest.php index d9669ae06e..f12ab958f7 100644 --- a/tests/Unit/Service/FolderServiceTest.php +++ b/tests/Unit/Service/FolderServiceTest.php @@ -10,7 +10,6 @@ use Exception; use OCA\Libresign\Service\FolderService; -use OCP\AppFramework\Services\IAppConfig; use OCP\Files\AppData\IAppDataFactory; use OCP\Files\Config\IUserMountCache; use OCP\Files\Folder; @@ -18,6 +17,7 @@ use OCP\Files\IRootFolder; use OCP\Files\SimpleFS\ISimpleFile; use OCP\Files\SimpleFS\ISimpleFolder; +use OCP\IAppConfig; use OCP\IGroupManager; use OCP\IL10N; use PHPUnit\Framework\MockObject\MockObject; diff --git a/tests/Unit/Service/Install/SignSetupServiceTest.php b/tests/Unit/Service/Install/SignSetupServiceTest.php index c21aa11e0a..fb355f6352 100644 --- a/tests/Unit/Service/Install/SignSetupServiceTest.php +++ b/tests/Unit/Service/Install/SignSetupServiceTest.php @@ -11,9 +11,11 @@ use bovigo\vfs\vfsStream; use OC\IntegrityCheck\Helpers\EnvironmentHelper; use OC\IntegrityCheck\Helpers\FileAccessHelper; +use OCA\Libresign\AppInfo\Application; use OCA\Libresign\Service\Install\SignSetupService; +use OCA\Libresign\Tests\lib\AppConfigOverwrite; use OCP\App\IAppManager; -use OCP\AppFramework\Services\IAppConfig; +use OCP\IAppConfig; use OCP\IConfig; use phpseclib\Crypt\RSA; use phpseclib\File\X509; @@ -24,7 +26,7 @@ final class SignSetupServiceTest extends \OCA\Libresign\Tests\Unit\TestCase { private EnvironmentHelper&MockObject $environmentHelper; private FileAccessHelper $fileAccessHelper; private IConfig&MockObject $config; - private IAppConfig&MockObject $appConfig; + private IAppConfig $appConfig; private IAppManager&MockObject $appManager; public function setUp(): void { @@ -32,7 +34,11 @@ public function setUp(): void { $this->fileAccessHelper = new FileAccessHelper(); $this->appManager = $this->createMock(IAppManager::class); $this->config = $this->createMock(IConfig::class); - $this->appConfig = $this->createMock(IAppConfig::class); + $this->appConfig = new AppConfigOverwrite( + \OCP\Server::get(\OCP\IDBConnection::class), + \OCP\Server::get(\Psr\Log\LoggerInterface::class), + \OCP\Server::get(\OCP\Security\ICrypto::class), + ); } /** @@ -88,7 +94,7 @@ private function writeAppSignature(string $architecture, $resource): SignSetupSe ->willReturn('vfs://home'); $this->appConfig - ->method('getAppValue') + ->method('getValueString') ->willReturnCallback(function ($key, $default) use ($architecture):string { return match ($key) { 'java_path' => 'vfs://home/data/appdata_1/libresign/' . $architecture . '/linux/java/jdk-21.0.2+13-jre/bin/java', @@ -205,17 +211,10 @@ public function testVerify(): void { #[DataProvider('dataGetInstallPath')] public function testGetInstallPath(string $architecture, string $resource, string $distro, string $expected): void { - $this->appConfig - ->method('getAppValue') - ->willReturnCallback(function ($key, $default): string { - return match ($key) { - 'java_path' => 'vfs://home/data/appdata_1/libresign/x86_64/linux/java/jdk-21.0.2+13-jre/bin/java', - 'jsignpdf_jar_path' => 'vfs://home/data/appdata_1/libresign/x86_64/jsignpdf/jsignpdf-2.2.2/JSignPdf.jar', - 'pdftk_path' => 'vfs://home/data/appdata_1/libresign/x86_64/pdftk/pdftk.jar', - 'cfssl_bin' => 'vfs://home/data/appdata_1/libresign/x86_64/cfssl/cfssl', - default => '', - }; - }); + $this->appConfig->setValueString(Application::APP_ID, 'java_path', 'vfs://home/data/appdata_1/libresign/x86_64/linux/java/jdk-21.0.2+13-jre/bin/java'); + $this->appConfig->setValueString(Application::APP_ID, 'jsignpdf_jar_path', 'vfs://home/data/appdata_1/libresign/x86_64/jsignpdf/jsignpdf-2.2.2/JSignPdf.jar'); + $this->appConfig->setValueString(Application::APP_ID, 'pdftk_path', 'vfs://home/data/appdata_1/libresign/x86_64/pdftk/pdftk.jar'); + $this->appConfig->setValueString(Application::APP_ID, 'cfssl_bin', 'vfs://home/data/appdata_1/libresign/x86_64/cfssl/cfssl'); $actual = $this->getInstance() ->setArchitecture($architecture) ->setDistro($distro) diff --git a/tests/Unit/Service/InstallServiceTest.php b/tests/Unit/Service/InstallServiceTest.php index d7842c3614..8cf3bd1c07 100644 --- a/tests/Unit/Service/InstallServiceTest.php +++ b/tests/Unit/Service/InstallServiceTest.php @@ -12,10 +12,10 @@ use OCA\Libresign\Handler\CertificateEngine\Handler as CertificateEngineHandler; use OCA\Libresign\Service\Install\InstallService; use OCA\Libresign\Service\Install\SignSetupService; -use OCP\AppFramework\Services\IAppConfig; use OCP\Files\AppData\IAppDataFactory; use OCP\Files\IRootFolder; use OCP\Http\Client\IClientService; +use OCP\IAppConfig; use OCP\ICacheFactory; use OCP\IConfig; use PHPUnit\Framework\MockObject\MockObject; diff --git a/tests/Unit/Service/MailServiceTest.php b/tests/Unit/Service/MailServiceTest.php index 6b7cf64cc0..6ced6f751a 100644 --- a/tests/Unit/Service/MailServiceTest.php +++ b/tests/Unit/Service/MailServiceTest.php @@ -12,7 +12,7 @@ use OCA\Libresign\Db\FileMapper; use OCA\Libresign\Db\SignRequest; use OCA\Libresign\Service\MailService; -use OCP\AppFramework\Services\IAppConfig; +use OCP\IAppConfig; use OCP\IL10N; use OCP\IURLGenerator; use OCP\Mail\IMailer; @@ -74,8 +74,8 @@ public function testSuccessNotifyUnsignedUser():void { ->method('getById') ->will($this->returnValue($file)); $this->appConfig - ->method('getAppValue') - ->willReturn('1'); + ->method('getValueBool') + ->willReturn(true); $actual = $this->service->notifyUnsignedUser($signRequest, 'a@b.coop'); $this->assertNull($actual); } @@ -108,8 +108,8 @@ public function testFailToSendMailToUnsignedUser():void { throw new \Exception('Error Processing Request', 1); }); $this->appConfig - ->method('getAppValue') - ->will($this->returnValue('1')); + ->method('getValueBool') + ->will($this->retruenValue('1')); $actual = $this->service->notifyUnsignedUser($signRequest, 'a@b.coop'); $this->assertNull($actual); } diff --git a/tests/Unit/Service/SignFileServiceTest.php b/tests/Unit/Service/SignFileServiceTest.php index cbe9d3ddfc..fc79396d28 100644 --- a/tests/Unit/Service/SignFileServiceTest.php +++ b/tests/Unit/Service/SignFileServiceTest.php @@ -20,12 +20,12 @@ use OCA\Libresign\Service\IdentifyMethodService; use OCA\Libresign\Service\SignerElementsService; use OCA\Libresign\Service\SignFileService; -use OCP\AppFramework\Services\IAppConfig; use OCP\AppFramework\Utility\ITimeFactory; use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Config\IUserMountCache; use OCP\Files\IRootFolder; use OCP\Http\Client\IClientService; +use OCP\IAppConfig; use OCP\IL10N; use OCP\ITempManager; use OCP\IURLGenerator; diff --git a/tests/Unit/Settings/AdminTest.php b/tests/Unit/Settings/AdminTest.php index af69700c04..a341a8b322 100644 --- a/tests/Unit/Settings/AdminTest.php +++ b/tests/Unit/Settings/AdminTest.php @@ -12,8 +12,8 @@ use OCA\Libresign\Handler\CertificateEngine\Handler as CertificateEngineHandler; use OCA\Libresign\Service\IdentifyMethodService; use OCA\Libresign\Settings\Admin; -use OCP\AppFramework\Services\IAppConfig; use OCP\AppFramework\Services\IInitialState; +use OCP\IAppConfig; use PHPUnit\Framework\MockObject\MockObject; /** diff --git a/tests/integration/features/page/validate.feature b/tests/integration/features/page/validate.feature index 744c9a09fb..31c8ddc8a3 100644 --- a/tests/integration/features/page/validate.feature +++ b/tests/integration/features/page/validate.feature @@ -12,7 +12,7 @@ Feature: page/validate Scenario: Unauthenticated user can not see sign page Given as user "admin" Given sending "post" to ocs "/apps/provisioning_api/api/v1/config/apps/libresign/make_validation_url_private" - | value | 1 | + | value | true | And as user "" When sending "get" to "/apps/libresign/p/validation" And the response should be a JSON array with the following mandatory values