Skip to content

Commit a641dfb

Browse files
authored
Merge pull request #6014 from LibreSign/backport/6012/stable32
[stable32] feat: docmdp iso validation
2 parents c36869c + 19968c4 commit a641dfb

8 files changed

Lines changed: 1456 additions & 0 deletions

File tree

lib/Db/File.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
* @method int getStatus()
3737
* @method void setMetadata(array $metadata)
3838
* @method ?array getMetadata()
39+
* @method void setModificationStatus(int $modificationStatus)
40+
* @method int getModificationStatus()
3941
*/
4042
class File extends Entity {
4143
protected int $nodeId = 0;
@@ -49,13 +51,19 @@ class File extends Entity {
4951
protected ?string $signedHash = null;
5052
protected ?string $callback = null;
5153
protected ?array $metadata = null;
54+
protected int $modificationStatus = 0;
5255
public const STATUS_NOT_LIBRESIGN_FILE = -1;
5356
public const STATUS_DRAFT = 0;
5457
public const STATUS_ABLE_TO_SIGN = 1;
5558
public const STATUS_PARTIAL_SIGNED = 2;
5659
public const STATUS_SIGNED = 3;
5760
public const STATUS_DELETED = 4;
5861

62+
public const MODIFICATION_UNCHECKED = 0;
63+
public const MODIFICATION_UNMODIFIED = 1;
64+
public const MODIFICATION_ALLOWED = 2;
65+
public const MODIFICATION_VIOLATION = 3;
66+
5967
public function __construct() {
6068
$this->addType('id', Types::INTEGER);
6169
$this->addType('nodeId', Types::INTEGER);
@@ -69,6 +77,7 @@ public function __construct() {
6977
$this->addType('callback', Types::STRING);
7078
$this->addType('status', Types::INTEGER);
7179
$this->addType('metadata', Types::JSON);
80+
$this->addType('modificationStatus', Types::SMALLINT);
7281
}
7382

7483
public function isDeletedAccount(): bool {

lib/Enum/DocMdpLevel.php

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
/**
6+
* SPDX-FileCopyrightText: 2025 LibreCode coop and contributors
7+
* SPDX-License-Identifier: AGPL-3.0-or-later
8+
*/
9+
10+
namespace OCA\Libresign\Enum;
11+
12+
use OCP\IL10N;
13+
14+
enum DocMdpLevel: int {
15+
case NONE = 0;
16+
case NO_CHANGES = 1;
17+
case FORM_FILL = 2;
18+
case FORM_FILL_AND_ANNOTATIONS = 3;
19+
20+
public function isCertifying(): bool {
21+
return $this !== self::NONE;
22+
}
23+
24+
public function getLabel(IL10N $l10n): string {
25+
return match($this) {
26+
self::NONE => $l10n->t('No certification'),
27+
self::NO_CHANGES => $l10n->t('No changes allowed'),
28+
self::FORM_FILL => $l10n->t('Form filling and additional signatures'),
29+
self::FORM_FILL_AND_ANNOTATIONS => $l10n->t('Form filling, annotations and additional signatures'),
30+
};
31+
}
32+
33+
public function getDescription(IL10N $l10n): string {
34+
return match($this) {
35+
self::NONE => $l10n->t('Document is not certified. No restrictions on modifications.'),
36+
self::NO_CHANGES => $l10n->t('No changes allowed. Additional approval signatures are prohibited.'),
37+
self::FORM_FILL => $l10n->t('Form filling allowed. Additional approval signatures are allowed.'),
38+
self::FORM_FILL_AND_ANNOTATIONS => $l10n->t('Form filling and annotations allowed. Additional approval signatures are allowed.'),
39+
};
40+
}
41+
}

0 commit comments

Comments
 (0)