feat: add NONE mode to SignatureFlow enum

Allow admin to not enforce signing flow, letting users choose
per document. Updates enum, File entity, and migration defaults.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
This commit is contained in:
Vitor Mattos 2025-12-17 02:03:20 -03:00
parent 42c025b122
commit dd0ac0a007
No known key found for this signature in database
GPG key ID: 6FECE2AD4809003A
3 changed files with 7 additions and 3 deletions

View file

@ -57,7 +57,7 @@ class File extends Entity {
protected ?string $callback = null;
protected ?array $metadata = null;
protected int $modificationStatus = 0;
protected int $signatureFlow = SignatureFlow::NUMERIC_PARALLEL;
protected int $signatureFlow = SignatureFlow::NUMERIC_NONE;
protected int $docmdpLevel = 0;
public const STATUS_NOT_LIBRESIGN_FILE = -1;
public const STATUS_DRAFT = 0;

View file

@ -13,14 +13,17 @@ namespace OCA\Libresign\Enum;
* Signature flow modes
*/
enum SignatureFlow: string {
case NONE = 'none';
case PARALLEL = 'parallel';
case ORDERED_NUMERIC = 'ordered_numeric';
public const NUMERIC_NONE = 0;
public const NUMERIC_PARALLEL = 1;
public const NUMERIC_ORDERED_NUMERIC = 2;
public function toNumeric(): int {
return match($this) {
self::NONE => self::NUMERIC_NONE,
self::PARALLEL => self::NUMERIC_PARALLEL,
self::ORDERED_NUMERIC => self::NUMERIC_ORDERED_NUMERIC,
};
@ -28,6 +31,7 @@ enum SignatureFlow: string {
public static function fromNumeric(int $value): self {
return match($value) {
self::NUMERIC_NONE => self::NONE,
self::NUMERIC_PARALLEL => self::PARALLEL,
self::NUMERIC_ORDERED_NUMERIC => self::ORDERED_NUMERIC,
default => throw new \ValueError("Invalid numeric value for SignatureFlow: $value"),

View file

@ -62,8 +62,8 @@ class Version15000Date20251209000000 extends SimpleMigrationStep {
if (!$tableFile->hasColumn('signature_flow')) {
$tableFile->addColumn('signature_flow', Types::SMALLINT, [
'notnull' => true,
'default' => SignatureFlow::NUMERIC_PARALLEL,
'comment' => 'Signature flow mode: 1=parallel, 2=ordered_numeric',
'default' => SignatureFlow::NUMERIC_NONE,
'comment' => 'Signature flow mode: 0=none (no admin enforcement), 1=parallel, 2=ordered_numeric',
]);
}
}