Skip to content

Commit

Permalink
Merge pull request #4143 from LibreSign/backport/4139/stable29
Browse files Browse the repository at this point in the history
[stable29] fix: load signature methods
  • Loading branch information
vitormattos authored Dec 13, 2024
2 parents 2e3983a + 8d2f059 commit 7ac2d58
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 2 deletions.
11 changes: 11 additions & 0 deletions lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,16 @@
* type: string,
* coordinates: LibresignCoordinate,
* }
* @psalm-type LibresignSignatureMethod = array{
* enabled: bool,
* label: string,
* name: string,
* }
* @psalm-type LibresignSignatureMethods = array{
* clickToSign?: LibresignSignatureMethod,
* emailToken?: LibresignSignatureMethod,
* password?: LibresignSignatureMethod,
* }
* @psalm-type LibresignSigner = array{
* description: ?string,
* displayName: string,
Expand All @@ -133,6 +143,7 @@
* signRequestId: non-negative-int,
* identifyMethods?: LibresignIdentifyMethod[],
* visibleElements?: LibresignVisibleElement[],
* signatureMethods?: LibresignSignatureMethods[],
* }
* @psalm-type LibresignValidateFile = array{
* uuid: string,
Expand Down
4 changes: 2 additions & 2 deletions lib/Service/FileService.php
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,8 @@ private function getSigners(): array {
}
}
}
if ($signatureToShow['me'] && !is_null($this->signRequest)) {
$signatureToShow['signatureMethods'] = $this->identifyMethodService->getSignMethodsOfIdentifiedFactors($this->signRequest->getId());
if ($signatureToShow['me']) {
$signatureToShow['signatureMethods'] = $this->identifyMethodService->getSignMethodsOfIdentifiedFactors($signer->getId());
}
$signatureToShow['identifyMethods'] = array_reduce($signatureToShow['identifyMethods'], function ($carry, $list) {
foreach ($list as $identifyMethod) {
Expand Down
39 changes: 39 additions & 0 deletions openapi-full.json
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,39 @@
}
}
},
"SignatureMethod": {
"type": "object",
"required": [
"enabled",
"label",
"name"
],
"properties": {
"enabled": {
"type": "boolean"
},
"label": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"SignatureMethods": {
"type": "object",
"properties": {
"clickToSign": {
"$ref": "#/components/schemas/SignatureMethod"
},
"emailToken": {
"$ref": "#/components/schemas/SignatureMethod"
},
"password": {
"$ref": "#/components/schemas/SignatureMethod"
}
}
},
"Signer": {
"type": "object",
"required": [
Expand Down Expand Up @@ -650,6 +683,12 @@
"items": {
"$ref": "#/components/schemas/VisibleElement"
}
},
"signatureMethods": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SignatureMethods"
}
}
}
},
Expand Down
39 changes: 39 additions & 0 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,39 @@
}
}
},
"SignatureMethod": {
"type": "object",
"required": [
"enabled",
"label",
"name"
],
"properties": {
"enabled": {
"type": "boolean"
},
"label": {
"type": "string"
},
"name": {
"type": "string"
}
}
},
"SignatureMethods": {
"type": "object",
"properties": {
"clickToSign": {
"$ref": "#/components/schemas/SignatureMethod"
},
"emailToken": {
"$ref": "#/components/schemas/SignatureMethod"
},
"password": {
"$ref": "#/components/schemas/SignatureMethod"
}
}
},
"Signer": {
"type": "object",
"required": [
Expand Down Expand Up @@ -554,6 +587,12 @@
"items": {
"$ref": "#/components/schemas/VisibleElement"
}
},
"signatureMethods": {
"type": "array",
"items": {
"$ref": "#/components/schemas/SignatureMethods"
}
}
}
},
Expand Down
11 changes: 11 additions & 0 deletions src/types/openapi/openapi-full.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1205,6 +1205,16 @@ export type components = {
needIdentificationDocuments?: boolean;
identificationDocumentsWaitingApproval?: boolean;
};
SignatureMethod: {
enabled: boolean;
label: string;
name: string;
};
SignatureMethods: {
clickToSign?: components["schemas"]["SignatureMethod"];
emailToken?: components["schemas"]["SignatureMethod"];
password?: components["schemas"]["SignatureMethod"];
};
Signer: {
description: string | null;
displayName: string;
Expand All @@ -1219,6 +1229,7 @@ export type components = {
signRequestId: number;
identifyMethods?: components["schemas"]["IdentifyMethod"][];
visibleElements?: components["schemas"]["VisibleElement"][];
signatureMethods?: components["schemas"]["SignatureMethods"][];
};
UserElement: {
/** Format: int64 */
Expand Down
11 changes: 11 additions & 0 deletions src/types/openapi/openapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1059,6 +1059,16 @@ export type components = {
needIdentificationDocuments?: boolean;
identificationDocumentsWaitingApproval?: boolean;
};
SignatureMethod: {
enabled: boolean;
label: string;
name: string;
};
SignatureMethods: {
clickToSign?: components["schemas"]["SignatureMethod"];
emailToken?: components["schemas"]["SignatureMethod"];
password?: components["schemas"]["SignatureMethod"];
};
Signer: {
description: string | null;
displayName: string;
Expand All @@ -1073,6 +1083,7 @@ export type components = {
signRequestId: number;
identifyMethods?: components["schemas"]["IdentifyMethod"][];
visibleElements?: components["schemas"]["VisibleElement"][];
signatureMethods?: components["schemas"]["SignatureMethods"][];
};
UserElement: {
/** Format: int64 */
Expand Down

0 comments on commit 7ac2d58

Please sign in to comment.