Skip to content

Commit 0c61b4e

Browse files
committed
Revert "Merge pull request #7314 from LibreSign/feat/policy-signature-flow-phase1-groundwork"
This reverts commit 5405914, reversing changes made to 7005206. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 5405914 commit 0c61b4e

111 files changed

Lines changed: 1499 additions & 26062 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

composer.lock

Lines changed: 11 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Command/Developer/Reset.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,6 @@ protected function configure(): void {
9696
mode: InputOption::VALUE_NONE,
9797
description: 'Reset config'
9898
)
99-
->addOption(
100-
name: 'policy',
101-
shortcut: null,
102-
mode: InputOption::VALUE_NONE,
103-
description: 'Reset policy data'
104-
)
10599
;
106100
}
107101

@@ -146,10 +140,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
146140
$this->resetConfig();
147141
$ok = true;
148142
}
149-
if ($input->getOption('policy') || $all) {
150-
$this->resetPolicy();
151-
$ok = true;
152-
}
153143
} catch (\Exception $e) {
154144
$this->logger->error($e->getMessage());
155145
throw $e;
@@ -264,17 +254,4 @@ private function resetConfig(): void {
264254
} catch (\Throwable) {
265255
}
266256
}
267-
268-
private function resetPolicy(): void {
269-
try {
270-
$delete = $this->db->getQueryBuilder();
271-
$delete->delete('libresign_permission_set_binding')
272-
->executeStatement();
273-
274-
$delete = $this->db->getQueryBuilder();
275-
$delete->delete('libresign_permission_set')
276-
->executeStatement();
277-
} catch (\Throwable) {
278-
}
279-
}
280257
}

lib/Controller/AdminController.php

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
use OCA\Libresign\Service\IdentifyMethodService;
2525
use OCA\Libresign\Service\Install\ConfigureCheckService;
2626
use OCA\Libresign\Service\Install\InstallService;
27-
use OCA\Libresign\Service\Policy\PolicyService;
2827
use OCA\Libresign\Service\ReminderService;
2928
use OCA\Libresign\Service\SignatureBackgroundService;
3029
use OCA\Libresign\Service\SignatureTextService;
@@ -84,7 +83,6 @@ public function __construct(
8483
private ReminderService $reminderService,
8584
private FooterService $footerService,
8685
private DocMdpConfigService $docMdpConfigService,
87-
private PolicyService $policyService,
8886
private IdentifyMethodService $identifyMethodService,
8987
private FileMapper $fileMapper,
9088
) {
@@ -976,21 +974,36 @@ private function saveOrDeleteConfig(string $key, ?string $value, string $default
976974
#[ApiRoute(verb: 'POST', url: '/api/{apiVersion}/admin/signature-flow/config', requirements: ['apiVersion' => '(v1)'])]
977975
public function setSignatureFlowConfig(bool $enabled, ?string $mode = null): DataResponse {
978976
try {
979-
if ($enabled && $mode === null) {
977+
if (!$enabled) {
978+
$this->appConfig->deleteKey(Application::APP_ID, 'signature_flow');
979+
return new DataResponse([
980+
'message' => $this->l10n->t('Settings saved'),
981+
]);
982+
}
983+
984+
if ($mode === null) {
980985
return new DataResponse([
981986
'error' => $this->l10n->t('Mode is required when signature flow is enabled.'),
982987
], Http::STATUS_BAD_REQUEST);
983988
}
984989

985-
$this->policyService->saveSystem('signature_flow', $enabled ? $mode : null);
990+
try {
991+
$signatureFlow = \OCA\Libresign\Enum\SignatureFlow::from($mode);
992+
} catch (\ValueError) {
993+
return new DataResponse([
994+
'error' => $this->l10n->t('Invalid signature flow mode. Use "parallel" or "ordered_numeric".'),
995+
], Http::STATUS_BAD_REQUEST);
996+
}
997+
998+
$this->appConfig->setValueString(
999+
Application::APP_ID,
1000+
'signature_flow',
1001+
$signatureFlow->value
1002+
);
9861003

9871004
return new DataResponse([
9881005
'message' => $this->l10n->t('Settings saved'),
9891006
]);
990-
} catch (\InvalidArgumentException) {
991-
return new DataResponse([
992-
'error' => $this->l10n->t('Invalid signature flow mode. Use "parallel" or "ordered_numeric".'),
993-
], Http::STATUS_BAD_REQUEST);
9941007
} catch (\Exception $e) {
9951008
return new DataResponse([
9961009
'error' => $e->getMessage(),

lib/Controller/PageController.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
use OCA\Libresign\Service\FileService;
2424
use OCA\Libresign\Service\IdentifyMethod\SignatureMethod\TokenService;
2525
use OCA\Libresign\Service\IdentifyMethodService;
26-
use OCA\Libresign\Service\Policy\PolicyService;
2726
use OCA\Libresign\Service\RequestSignatureService;
2827
use OCA\Libresign\Service\SessionService;
2928
use OCA\Libresign\Service\SignerElementsService;
@@ -59,7 +58,6 @@ public function __construct(
5958
private AccountService $accountService,
6059
protected SignFileService $signFileService,
6160
protected RequestSignatureService $requestSignatureService,
62-
private PolicyService $policyService,
6361
private SignerElementsService $signerElementsService,
6462
protected IL10N $l10n,
6563
private IdentifyMethodService $identifyMethodService,
@@ -108,13 +106,7 @@ public function index(): TemplateResponse {
108106

109107
$this->provideSignerSignatues();
110108
$this->initialState->provideInitialState('identify_methods', $this->identifyMethodService->getIdentifyMethodsSettings());
111-
$resolvedPolicies = [];
112-
foreach ($this->policyService->resolveKnownPolicies() as $policyKey => $resolvedPolicy) {
113-
$resolvedPolicies[$policyKey] = $resolvedPolicy->toArray();
114-
}
115-
$this->initialState->provideInitialState('effective_policies', [
116-
'policies' => $resolvedPolicies,
117-
]);
109+
$this->initialState->provideInitialState('signature_flow', $this->appConfig->getValueString(Application::APP_ID, 'signature_flow', \OCA\Libresign\Enum\SignatureFlow::NONE->value));
118110
$this->initialState->provideInitialState('docmdp_config', $this->docMdpConfigService->getConfig());
119111
$this->initialState->provideInitialState('legal_information', $this->appConfig->getValueString(Application::APP_ID, 'legal_information'));
120112

0 commit comments

Comments
 (0)