1414use OCA \Libresign \Service \AccountService ;
1515use OCA \Libresign \Service \CertificatePolicyService ;
1616use OCA \Libresign \Service \FooterService ;
17+ use OCA \Libresign \Service \IdentifyMethodService ;
1718use OCA \Libresign \Service \Policy \PolicyService ;
19+ use OCA \Libresign \Service \Policy \Provider \LegalInformation \LegalInformationPolicy ;
20+ use OCA \Libresign \Service \Policy \Provider \SignatureBackground \SignatureBackgroundPolicy ;
21+ use OCA \Libresign \Service \Policy \Provider \Tsa \TsaPolicy ;
22+ use OCA \Libresign \Service \Policy \Provider \Tsa \TsaPolicyValue ;
1823use OCA \Libresign \Service \SignatureTextService ;
1924use OCP \AppFramework \Http \ContentSecurityPolicy ;
2025use OCP \AppFramework \Http \TemplateResponse ;
@@ -42,6 +47,7 @@ public function __construct(
4247 private SignatureTextService $ signatureTextService ,
4348 private FooterService $ footerService ,
4449 private PolicyService $ policyService ,
50+ private IdentifyMethodService $ identifyMethodService ,
4551 ) {
4652 }
4753 #[\Override]
@@ -60,7 +66,9 @@ public function getForm(): TemplateResponse {
6066 $ this ->initialState ->provideInitialState ('certificate_policies_oid ' , $ this ->certificatePolicyService ->getOid ());
6167 $ this ->initialState ->provideInitialState ('certificate_policies_cps ' , $ this ->certificatePolicyService ->getCps ());
6268 $ this ->initialState ->provideInitialState ('config_path ' , $ this ->appConfig ->getValueString (Application::APP_ID , 'config_path ' ));
69+ $ this ->initialState ->provideInitialState ('legal_information ' , (string )$ this ->policyService ->resolve (LegalInformationPolicy::KEY )->getEffectiveValue ());
6370 $ this ->initialState ->provideInitialState ('signature_available_variables ' , $ this ->signatureTextService ->getAvailableVariables ());
71+ $ this ->initialState ->provideInitialState ('signature_background_type ' , (string )$ this ->policyService ->resolve (SignatureBackgroundPolicy::KEY )->getEffectiveValue ());
6472 $ this ->initialState ->provideInitialState ('signature_preview_zoom_level ' , $ this ->appConfig ->getValueFloat (Application::APP_ID , 'signature_preview_zoom_level ' , 100 ));
6573 $ this ->initialState ->provideInitialState ('footer_preview_zoom_level ' , $ this ->appConfig ->getValueFloat (Application::APP_ID , 'footer_preview_zoom_level ' , 100 ));
6674 $ this ->initialState ->provideInitialState ('footer_preview_width ' , $ this ->appConfig ->getValueInt (Application::APP_ID , 'footer_preview_width ' , 595 ));
@@ -70,6 +78,13 @@ public function getForm(): TemplateResponse {
7078 $ this ->initialState ->provideInitialState ('footer_template ' , $ this ->footerService ->getTemplate ());
7179 $ this ->initialState ->provideInitialState ('footer_template_is_default ' , $ this ->footerService ->isDefaultTemplate ());
7280 $ this ->initialState ->provideInitialState ('signature_engine ' , $ this ->getSignatureEngineInitialState ());
81+ $ tsaSettings = $ this ->getTsaInitialState ();
82+ $ this ->initialState ->provideInitialState ('tsa_url ' , $ tsaSettings ['url ' ]);
83+ $ this ->initialState ->provideInitialState ('tsa_policy_oid ' , $ tsaSettings ['policy_oid ' ]);
84+ $ this ->initialState ->provideInitialState ('tsa_auth_type ' , $ tsaSettings ['auth_type ' ]);
85+ $ this ->initialState ->provideInitialState ('tsa_username ' , $ tsaSettings ['username ' ]);
86+ $ this ->initialState ->provideInitialState ('tsa_password ' , $ this ->appConfig ->getValueString (Application::APP_ID , 'tsa_password ' , self ::PASSWORD_PLACEHOLDER ));
87+ $ this ->initialState ->provideInitialState ('identify_methods ' , $ this ->identifyMethodService ->getIdentifyMethodsSettings ());
7388 $ resolvedPolicies = [];
7489 foreach ($ this ->policyService ->resolveKnownPolicies () as $ policyKey => $ resolvedPolicy ) {
7590 $ resolvedPolicies [$ policyKey ] = $ resolvedPolicy ->toArray ();
@@ -79,7 +94,12 @@ public function getForm(): TemplateResponse {
7994 ]);
8095 $ this ->initialState ->provideInitialState ('signing_mode ' , $ this ->getSigningModeInitialState ());
8196 $ this ->initialState ->provideInitialState ('worker_type ' , $ this ->getWorkerTypeInitialState ());
97+ $ this ->initialState ->provideInitialState ('identification_documents ' , $ this ->appConfig ->getValueBool (Application::APP_ID , 'identification_documents ' , false ));
98+ $ this ->initialState ->provideInitialState ('approval_group ' , $ this ->appConfig ->getValueString (Application::APP_ID , 'approval_group ' , '["admin"] ' ));
99+ $ this ->initialState ->provideInitialState ('envelope_enabled ' , $ this ->appConfig ->getValueBool (Application::APP_ID , 'envelope_enabled ' , true ));
82100 $ this ->initialState ->provideInitialState ('parallel_workers ' , $ this ->appConfig ->getValueString (Application::APP_ID , 'parallel_workers ' , '4 ' ));
101+ $ this ->initialState ->provideInitialState ('show_confetti_after_signing ' , $ this ->appConfig ->getValueBool (Application::APP_ID , 'show_confetti_after_signing ' , true ));
102+ $ this ->initialState ->provideInitialState ('crl_external_validation_enabled ' , $ this ->appConfig ->getValueBool (Application::APP_ID , 'crl_external_validation_enabled ' , true ));
83103 $ this ->initialState ->provideInitialState ('ldap_extension_available ' , function_exists ('ldap_connect ' ));
84104
85105 $ response = new TemplateResponse (Application::APP_ID , 'admin_settings ' );
@@ -133,4 +153,22 @@ private function getWorkerTypeInitialState(): string {
133153 }
134154 return 'local ' ;
135155 }
156+
157+ /**
158+ * @return array{url: string, policy_oid: string, auth_type: string, username: string}
159+ */
160+ private function getTsaInitialState (): array {
161+ $ resolved = $ this ->policyService ->resolve (TsaPolicy::KEY )->getEffectiveValue ();
162+ $ settings = TsaPolicyValue::decode ($ resolved );
163+ if (!empty ($ settings ['url ' ])) {
164+ return $ settings ;
165+ }
166+
167+ return [
168+ 'url ' => $ this ->appConfig ->getValueString (Application::APP_ID , 'tsa_url ' , '' ),
169+ 'policy_oid ' => $ this ->appConfig ->getValueString (Application::APP_ID , 'tsa_policy_oid ' , '' ),
170+ 'auth_type ' => $ this ->appConfig ->getValueString (Application::APP_ID , 'tsa_auth_type ' , 'none ' ),
171+ 'username ' => $ this ->appConfig ->getValueString (Application::APP_ID , 'tsa_username ' , '' ),
172+ ];
173+ }
136174}
0 commit comments