mirror of
https://github.com/LibreSign/libresign.git
synced 2025-12-17 21:12:16 +01:00
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:
parent
42c025b122
commit
dd0ac0a007
3 changed files with 7 additions and 3 deletions
|
|
@ -57,7 +57,7 @@ class File extends Entity {
|
||||||
protected ?string $callback = null;
|
protected ?string $callback = null;
|
||||||
protected ?array $metadata = null;
|
protected ?array $metadata = null;
|
||||||
protected int $modificationStatus = 0;
|
protected int $modificationStatus = 0;
|
||||||
protected int $signatureFlow = SignatureFlow::NUMERIC_PARALLEL;
|
protected int $signatureFlow = SignatureFlow::NUMERIC_NONE;
|
||||||
protected int $docmdpLevel = 0;
|
protected int $docmdpLevel = 0;
|
||||||
public const STATUS_NOT_LIBRESIGN_FILE = -1;
|
public const STATUS_NOT_LIBRESIGN_FILE = -1;
|
||||||
public const STATUS_DRAFT = 0;
|
public const STATUS_DRAFT = 0;
|
||||||
|
|
|
||||||
|
|
@ -13,14 +13,17 @@ namespace OCA\Libresign\Enum;
|
||||||
* Signature flow modes
|
* Signature flow modes
|
||||||
*/
|
*/
|
||||||
enum SignatureFlow: string {
|
enum SignatureFlow: string {
|
||||||
|
case NONE = 'none';
|
||||||
case PARALLEL = 'parallel';
|
case PARALLEL = 'parallel';
|
||||||
case ORDERED_NUMERIC = 'ordered_numeric';
|
case ORDERED_NUMERIC = 'ordered_numeric';
|
||||||
|
|
||||||
|
public const NUMERIC_NONE = 0;
|
||||||
public const NUMERIC_PARALLEL = 1;
|
public const NUMERIC_PARALLEL = 1;
|
||||||
public const NUMERIC_ORDERED_NUMERIC = 2;
|
public const NUMERIC_ORDERED_NUMERIC = 2;
|
||||||
|
|
||||||
public function toNumeric(): int {
|
public function toNumeric(): int {
|
||||||
return match($this) {
|
return match($this) {
|
||||||
|
self::NONE => self::NUMERIC_NONE,
|
||||||
self::PARALLEL => self::NUMERIC_PARALLEL,
|
self::PARALLEL => self::NUMERIC_PARALLEL,
|
||||||
self::ORDERED_NUMERIC => self::NUMERIC_ORDERED_NUMERIC,
|
self::ORDERED_NUMERIC => self::NUMERIC_ORDERED_NUMERIC,
|
||||||
};
|
};
|
||||||
|
|
@ -28,6 +31,7 @@ enum SignatureFlow: string {
|
||||||
|
|
||||||
public static function fromNumeric(int $value): self {
|
public static function fromNumeric(int $value): self {
|
||||||
return match($value) {
|
return match($value) {
|
||||||
|
self::NUMERIC_NONE => self::NONE,
|
||||||
self::NUMERIC_PARALLEL => self::PARALLEL,
|
self::NUMERIC_PARALLEL => self::PARALLEL,
|
||||||
self::NUMERIC_ORDERED_NUMERIC => self::ORDERED_NUMERIC,
|
self::NUMERIC_ORDERED_NUMERIC => self::ORDERED_NUMERIC,
|
||||||
default => throw new \ValueError("Invalid numeric value for SignatureFlow: $value"),
|
default => throw new \ValueError("Invalid numeric value for SignatureFlow: $value"),
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ class Version15000Date20251209000000 extends SimpleMigrationStep {
|
||||||
if (!$tableFile->hasColumn('signature_flow')) {
|
if (!$tableFile->hasColumn('signature_flow')) {
|
||||||
$tableFile->addColumn('signature_flow', Types::SMALLINT, [
|
$tableFile->addColumn('signature_flow', Types::SMALLINT, [
|
||||||
'notnull' => true,
|
'notnull' => true,
|
||||||
'default' => SignatureFlow::NUMERIC_PARALLEL,
|
'default' => SignatureFlow::NUMERIC_NONE,
|
||||||
'comment' => 'Signature flow mode: 1=parallel, 2=ordered_numeric',
|
'comment' => 'Signature flow mode: 0=none (no admin enforcement), 1=parallel, 2=ordered_numeric',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue