Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Controller/AccountController.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
* @psalm-import-type LibresignConfigValueResponse from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignUserConfigValue from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignCreateToSignResponse from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignFile from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignIdDocFile from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignMessageResponse from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignPagination from \OCA\Libresign\ResponseDefinitions
*/
Expand Down
13 changes: 8 additions & 5 deletions lib/Controller/AdminController.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ public function signatureBackgroundSave(): DataResponse {
/**
* Get custom background image
*
* @return FileDisplayResponse<Http::STATUS_OK, array{}>
* @return FileDisplayResponse<Http::STATUS_OK, array{Content-Disposition: 'attachment; filename="background.png"', Content-Type: 'image/png'}>
*
* 200: Image returned
*/
Expand All @@ -346,14 +346,17 @@ public function signatureBackgroundSave(): DataResponse {
public function signatureBackgroundGet(): FileDisplayResponse {
$file = $this->signatureBackgroundService->getImage();

$response = new FileDisplayResponse($file);
$response = new FileDisplayResponse($file, Http::STATUS_OK, [
'Content-Disposition' => 'attachment; filename="background.png"',
'Content-Type' => 'image/png',
]);
// The constructor always sets Content-Disposition to "inline" using the
// file name, so the attachment disposition must be set again afterwards.
$response->addHeader('Content-Disposition', 'attachment; filename="background.png"');
$csp = new ContentSecurityPolicy();
$csp->allowInlineStyle();
$response->setContentSecurityPolicy($csp);
$response->cacheFor(3600);
$response->addHeader('Content-Type', 'image/png');
$response->addHeader('Content-Disposition', 'attachment; filename="background.png"');
$response->addHeader('Content-Type', 'image/png');
return $response;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/CrlController.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
* @param string $instanceId Instance identifier
* @param int $generation Generation identifier
* @param string $engineType Engine type identifier
* @return DataDownloadResponse<Http::STATUS_OK, string, array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, LibresignCrlErrorResponse, array{}>
* @return DataDownloadResponse<Http::STATUS_OK, 'application/pkix-crl', array{}>|DataResponse<Http::STATUS_INTERNAL_SERVER_ERROR, LibresignCrlErrorResponse, array{}>
*
* 200: CRL retrieved successfully in DER format
* 500: Failed to generate CRL
Expand Down
6 changes: 3 additions & 3 deletions lib/Controller/FileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
use Psr\Log\LoggerInterface;

/**
* @psalm-import-type LibresignFile from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignIdDocFile from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignDetailedFile from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignDetailedFileResponse from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignActionErrorResponse from \OCA\Libresign\ResponseDefinitions
Expand Down Expand Up @@ -585,7 +585,7 @@ private function getMimeFallbackResponse(string $mimeType): ?\OCP\AppFramework\H
* @param string $name The name of file to sign
* @param LibresignFolderSettings $settings Settings to define how and where the file should be stored
* @param list<LibresignNewFile> $files Multiple files to create an envelope (optional, use either file or files)
* @return DataResponse<Http::STATUS_OK, LibresignDetailedFileResponse, array{}>|DataResponse<Http::STATUS_UNPROCESSABLE_ENTITY, LibresignMessageResponse, array{}>
* @return DataResponse<Http::STATUS_OK, LibresignDetailedFileResponse, array{}>|DataResponse<Http::STATUS_UNPROCESSABLE_ENTITY, LibresignMessageResponse|LibresignActionErrorResponse, array{}>
*
* 200: OK
* 422: Failed to save data
Expand Down Expand Up @@ -630,7 +630,7 @@ public function save(
* Multipart clients can send optional expectedFilesCount to reject incomplete batches.
*
* @param string $uuid The UUID of the envelope
* @return DataResponse<Http::STATUS_OK, LibresignDetailedFileResponse, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND|Http::STATUS_UNPROCESSABLE_ENTITY, LibresignMessageResponse, array{}>
* @return DataResponse<Http::STATUS_OK, LibresignDetailedFileResponse, array{}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_NOT_FOUND, LibresignMessageResponse, array{}>|DataResponse<Http::STATUS_UNPROCESSABLE_ENTITY, LibresignMessageResponse|LibresignActionErrorResponse, array{}>
*
* 200: Files added successfully
* 400: Invalid request
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/IdDocsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
use Psr\Log\LoggerInterface;

/**
* @psalm-import-type LibresignFile from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignIdDocFile from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignIdDocs from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignIdDocsApprovalListResponse from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignIdDocsListResponse from \OCA\Libresign\ResponseDefinitions
Expand Down
4 changes: 3 additions & 1 deletion lib/Controller/IdentifyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
use OCP\IRequest;

/**
* @psalm-import-type LibresignActionErrorResponse from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignIdentifyAccount from \OCA\Libresign\ResponseDefinitions
* @psalm-import-type LibresignIdentifyAccountsResponse from \OCA\Libresign\ResponseDefinitions
*/
Expand Down Expand Up @@ -59,9 +60,10 @@ public function __construct(
* @param string $method filter by method (email, account, sms, signal, telegram, whatsapp, whatsappbusiness, xmpp)
* @param int $page the number of page to return. Default: 1
* @param int $limit Total of elements to return. Default: 25
* @return DataResponse<Http::STATUS_OK, LibresignIdentifyAccountsResponse, array{}>
* @return DataResponse<Http::STATUS_OK, LibresignIdentifyAccountsResponse, array{}>|DataResponse<Http::STATUS_UNPROCESSABLE_ENTITY, LibresignActionErrorResponse, array{}>
*
* 200: Certificate saved with success
* 422: User is not allowed to request signatures
*/
#[NoAdminRequired]
#[RequireManager]
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/RequestSignatureController.php
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ public function updateSignatureRequest(
*
* @param integer $fileId LibreSign file ID
* @param integer $signRequestId The sign request id
* @return DataResponse<Http::STATUS_OK, LibresignMessageResponse, array{}>|DataResponse<Http::STATUS_UNAUTHORIZED, LibresignMessageResponse, array{}>|DataResponse<Http::STATUS_UNPROCESSABLE_ENTITY, LibresignActionErrorResponse, array{}>
* @return DataResponse<Http::STATUS_OK, LibresignMessageResponse, array{}>|DataResponse<Http::STATUS_UNAUTHORIZED, LibresignMessageResponse, array{}>|DataResponse<Http::STATUS_UNPROCESSABLE_ENTITY, LibresignMessageResponse|LibresignActionErrorResponse, array{}>
*
* 200: OK
* 401: Failed
Expand Down
12 changes: 6 additions & 6 deletions lib/ResponseDefinitions.php
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@
* name: string,
* status: int,
* statusText: string,
* nodeId: int,
* nodeId: ?int,
* totalPages?: non-negative-int,
* size: non-negative-int,
* pdfVersion?: string,
Expand All @@ -671,7 +671,7 @@
* name: string,
* status: 0|1|2|3|4|6,
* statusText: string,
* nodeId: non-negative-int,
* nodeId: non-negative-int|null,
* nodeType: 'file'|'envelope',
* signatureFlow: 'none'|'parallel'|'ordered_numeric',
* policySnapshotFrozen?: bool,
Expand Down Expand Up @@ -778,7 +778,7 @@
* files: list<LibresignFileListItem>,
* filesCount: int<0, max>,
* id: int,
* nodeId: int,
* nodeId: ?int,
* uuid: string,
* name: non-falsy-string,
* status: int,
Expand All @@ -805,7 +805,7 @@
*
* Account, elements, and ID document contracts
*
* @psalm-type LibresignFile = array{
* @psalm-type LibresignIdDocFile = array{
* account: array{
* userId: string,
* displayName: string,
Expand Down Expand Up @@ -882,11 +882,11 @@
* }
* @psalm-type LibresignIdDocsListResponse = array{
* pagination: LibresignPagination,
* data: list<LibresignFile>,
* data: list<LibresignIdDocFile>,
* }
* @psalm-type LibresignIdDocsApprovalListResponse = array{
* pagination: LibresignPagination,
* data: list<LibresignFile>,
* data: list<LibresignIdDocFile>,
* }
* @psalm-type LibresignCreateToSignPdfReference = array{
* url: string,
Expand Down
12 changes: 11 additions & 1 deletion openapi-administration.json
Original file line number Diff line number Diff line change
Expand Up @@ -2013,8 +2013,18 @@
"responses": {
"200": {
"description": "Image returned",
"headers": {
"Content-Disposition": {
"schema": {
"type": "string",
"enum": [
"attachment; filename=\"background.png\""
]
}
}
},
"content": {
"*/*": {
"image/png": {
"schema": {
"type": "string",
"format": "binary"
Expand Down
Loading
Loading