• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LibreSign / libresign / 20082918971

10 Dec 2025 12:22AM UTC coverage: 43.855%. First build
20082918971

Pull #6069

github

web-flow
Merge 3dbe84f48 into c646f673a
Pull Request #6069: feat: sequential signing

39 of 116 new or added lines in 7 files covered. (33.62%)

5727 of 13059 relevant lines covered (43.85%)

5.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

7.14
/lib/Settings/Admin.php
1
<?php
2

3
declare(strict_types=1);
4
/**
5
 * SPDX-FileCopyrightText: 2020-2024 LibreCode coop and contributors
6
 * SPDX-License-Identifier: AGPL-3.0-or-later
7
 */
8

9
namespace OCA\Libresign\Settings;
10

11
use OCA\Libresign\AppInfo\Application;
12
use OCA\Libresign\Exception\LibresignException;
13
use OCA\Libresign\Handler\CertificateEngine\CertificateEngineFactory;
14
use OCA\Libresign\Service\CertificatePolicyService;
15
use OCA\Libresign\Service\DocMdpConfigService;
16
use OCA\Libresign\Service\FooterService;
17
use OCA\Libresign\Service\IdentifyMethodService;
18
use OCA\Libresign\Service\SignatureBackgroundService;
19
use OCA\Libresign\Service\SignatureFlow;
20
use OCA\Libresign\Service\SignatureTextService;
21
use OCP\AppFramework\Http\TemplateResponse;
22
use OCP\AppFramework\Services\IInitialState;
23
use OCP\IAppConfig;
24
use OCP\Settings\ISettings;
25
use OCP\Util;
26

27
class Admin implements ISettings {
28
        public const PASSWORD_PLACEHOLDER = '••••••••';
29

30
        public function __construct(
31
                private IInitialState $initialState,
32
                private IdentifyMethodService $identifyMethodService,
33
                private CertificateEngineFactory $certificateEngineFactory,
34
                private CertificatePolicyService $certificatePolicyService,
35
                private IAppConfig $appConfig,
36
                private SignatureTextService $signatureTextService,
37
                private SignatureBackgroundService $signatureBackgroundService,
38
                private FooterService $footerService,
39
                private DocMdpConfigService $docMdpConfigService,
40
        ) {
41
        }
2✔
42
        #[\Override]
43
        public function getForm(): TemplateResponse {
44
                Util::addScript(Application::APP_ID, 'libresign-settings');
×
45
                try {
46
                        $signatureParsed = $this->signatureTextService->parse();
×
47
                        $this->initialState->provideInitialState('signature_text_parsed', $signatureParsed['parsed']);
×
48
                } catch (LibresignException $e) {
×
49
                        $this->initialState->provideInitialState('signature_text_parsed', '');
×
50
                        $this->initialState->provideInitialState('signature_text_template_error', $e->getMessage());
×
51
                }
52
                $this->initialState->provideInitialState('certificate_engine', $this->certificateEngineFactory->getEngine()->getName());
×
53
                $this->initialState->provideInitialState('certificate_policies_oid', $this->certificatePolicyService->getOid());
×
54
                $this->initialState->provideInitialState('certificate_policies_cps', $this->certificatePolicyService->getCps());
×
55
                $this->initialState->provideInitialState('config_path', $this->appConfig->getValueString(Application::APP_ID, 'config_path'));
×
56
                $this->initialState->provideInitialState('default_signature_font_size', SignatureTextService::SIGNATURE_DEFAULT_FONT_SIZE);
×
57
                $this->initialState->provideInitialState('default_signature_height', SignatureTextService::DEFAULT_SIGNATURE_HEIGHT);
×
58
                $this->initialState->provideInitialState('default_signature_text_template', $this->signatureTextService->getDefaultTemplate());
×
59
                $this->initialState->provideInitialState('default_signature_width', SignatureTextService::DEFAULT_SIGNATURE_WIDTH);
×
60
                $this->initialState->provideInitialState('default_template_font_size', $this->signatureTextService->getDefaultTemplateFontSize());
×
61
                $this->initialState->provideInitialState('identify_methods', $this->identifyMethodService->getIdentifyMethodsSettings());
×
62
                $this->initialState->provideInitialState('signature_available_variables', $this->signatureTextService->getAvailableVariables());
×
63
                $this->initialState->provideInitialState('signature_background_type', $this->signatureBackgroundService->getSignatureBackgroundType());
×
64
                $this->initialState->provideInitialState('signature_font_size', $this->signatureTextService->getSignatureFontSize());
×
65
                $this->initialState->provideInitialState('signature_height', $this->signatureTextService->getFullSignatureHeight());
×
66
                $this->initialState->provideInitialState('signature_preview_zoom_level', $this->appConfig->getValueFloat(Application::APP_ID, 'signature_preview_zoom_level', 100));
×
67
                $this->initialState->provideInitialState('footer_preview_zoom_level', $this->appConfig->getValueFloat(Application::APP_ID, 'footer_preview_zoom_level', 100));
×
68
                $this->initialState->provideInitialState('footer_preview_width', $this->appConfig->getValueInt(Application::APP_ID, 'footer_preview_width', 595));
×
69
                $this->initialState->provideInitialState('footer_preview_height', $this->appConfig->getValueInt(Application::APP_ID, 'footer_preview_height', 100));
×
70
                $this->initialState->provideInitialState('footer_template_variables', $this->footerService->getTemplateVariablesMetadata());
×
71
                $this->initialState->provideInitialState('footer_template', $this->footerService->getTemplate());
×
72
                $this->initialState->provideInitialState('footer_template_is_default', $this->footerService->isDefaultTemplate());
×
73
                $this->initialState->provideInitialState('signature_render_mode', $this->signatureTextService->getRenderMode());
×
74
                $this->initialState->provideInitialState('signature_text_template', $this->signatureTextService->getTemplate());
×
75
                $this->initialState->provideInitialState('signature_width', $this->signatureTextService->getFullSignatureWidth());
×
76
                $this->initialState->provideInitialState('template_font_size', $this->signatureTextService->getTemplateFontSize());
×
77
                $this->initialState->provideInitialState('tsa_url', $this->appConfig->getValueString(Application::APP_ID, 'tsa_url', ''));
×
78
                $this->initialState->provideInitialState('tsa_policy_oid', $this->appConfig->getValueString(Application::APP_ID, 'tsa_policy_oid', ''));
×
79
                $this->initialState->provideInitialState('tsa_auth_type', $this->appConfig->getValueString(Application::APP_ID, 'tsa_auth_type', 'none'));
×
80
                $this->initialState->provideInitialState('tsa_username', $this->appConfig->getValueString(Application::APP_ID, 'tsa_username', ''));
×
81
                $this->initialState->provideInitialState('tsa_password', $this->appConfig->getValueString(Application::APP_ID, 'tsa_password', self::PASSWORD_PLACEHOLDER));
×
82
                $this->initialState->provideInitialState('docmdp_config', $this->docMdpConfigService->getConfig());
×
NEW
83
                $this->initialState->provideInitialState('signature_flow', $this->appConfig->getValueString(Application::APP_ID, 'signature_flow', SignatureFlow::PARALLEL->value));
×
84
                return new TemplateResponse(Application::APP_ID, 'admin_settings');
×
85
        }
86

87
        /**
88
         * @psalm-return 'libresign'
89
         */
90
        #[\Override]
91
        public function getSection(): string {
92
                return Application::APP_ID;
1✔
93
        }
94

95
        /**
96
         * @psalm-return 100
97
         */
98
        #[\Override]
99
        public function getPriority(): int {
100
                return 100;
1✔
101
        }
102
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc