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

LibreSign / libresign / 20040103294

08 Dec 2025 07:23PM UTC coverage: 44.146%. First build
20040103294

Pull #6021

github

web-flow
Merge 6275726ed into eb7183cb5
Pull Request #6021: feat: docmdp implementation

66 of 113 new or added lines in 10 files covered. (58.41%)

5678 of 12862 relevant lines covered (44.15%)

5.1 hits per line

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

7.32
/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\SignatureTextService;
20
use OCP\AppFramework\Http\TemplateResponse;
21
use OCP\AppFramework\Services\IInitialState;
22
use OCP\IAppConfig;
23
use OCP\Settings\ISettings;
24
use OCP\Util;
25

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

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

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

93
        /**
94
         * @psalm-return 100
95
         */
96
        #[\Override]
97
        public function getPriority(): int {
98
                return 100;
1✔
99
        }
100
}
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