Skip to content

[stable32] feat: Sign usign only PHP#7125

Merged
vitormattos merged 41 commits intostable32from
backport/2595/stable32
Mar 5, 2026
Merged

[stable32] feat: Sign usign only PHP#7125
vitormattos merged 41 commits intostable32from
backport/2595/stable32

Conversation

@backportbot-libresign
Copy link

@backportbot-libresign backportbot-libresign bot commented Mar 5, 2026

Backport of #2595

Warning, This backport's changes differ from the original and might be incomplete ⚠️

Todo

  • Review and resolve any conflicts
  • Remove all the empty commits
  • Amend HEAD commit to remove the line stating to skip CI

Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

vitormattos and others added 30 commits March 5, 2026 15:47
Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: Vitor Mattos <vitor@php.rio>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Reduce line height from 1.2× to 1.15× font size for tighter spacing
- Set top padding to 0.35× line height to match JSignPdf output
- Ensures visual parity with JSignPdf's iText-based text rendering

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Replace string literal 'GRAPHIC_ONLY' with SignerElementsService::RENDER_MODE_GRAPHIC_ONLY
- Improves code consistency and maintainability

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Use date_default_timezone_get() instead of hardcoded UTC
- Ensures ServerSignatureDate reflects actual server timezone configuration
- Captures date at rendering time, not during params preparation

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- ServerSignatureDate is now injected at rendering time by each handler
- PhpNativeHandler uses server timezone
- JSignPdfHandler uses ${timestamp} placeholder
- Ensures proper timezone handling for each implementation

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- LocalSignerSignatureDateTime now uses user's timezone, not UTC
- Correctly reflects 'Local' in variable name
- Use date_default_timezone_get() for user's configured timezone
- LocalSignerTimezone parameter indicates which timezone was used

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…ervice

- Replace string literal 'GRAPHIC_ONLY' with SignerElementsService::RENDER_MODE_GRAPHIC_ONLY
- Add SignerElementsService import
- Improves code consistency across codebase

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- New render mode for PhpNativeHandler to show signature without description text
- Full canvas displays signature drawing with watermark background
- Extends existing JSignPdf render modes for PHP-only signing

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…bject text operators

Remove Imagick/ITempManager dependencies from PhpNativeHandler. All render modes now produce a SignatureAppearanceXObjectDto carrying PDF text stream operators instead of compositing raster images. The paradoxical-condition psalm issue is also resolved here - the max(0.0,...) guard was removed so the inner overflow check can fire.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…pearance branch

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Covers: wrapTextForPdf (4 cases), escapePdfText (5 cases), hasExistingSignatures (5 cases), buildTimestampOptions (4 cases), resolveCertificationLevel (4 cases), buildAppearanceForElement signature image placement (2 cases), buildXObject layout per render mode (4 cases).
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…signature params

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…x-start

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…re without placed elements

When admin sets GRAPHIC_ONLY render mode (canCreateSignature=true), the signer
must draw their signature even if no visual element box was placed on the
document. The previous check required visibleElements.some(...) which returned
false for documents with no placed boxes, silently skipping the drawing prompt.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
… elements

needsCreateSignature previously required visibleElements.some(...) to be true,
meaning it only triggered when the document had a pre-placed visual element box
for the signer. With GRAPHIC_ONLY render mode (canCreateSignature=true) and no
placed box, the check always returned false and the drawing prompt was never
shown.

Fix: when signerHasSignRequest=true is provided, return true immediately after
confirming the signer has a signRequestId — the visual box placement is
irrelevant for deciding whether to ask for a drawing.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
…ement

needCreateSignature computed was duplicating the validator logic and also

required a placed visual element box, so it returned false for clickToSign

documents in GRAPHIC_ONLY mode.

Added signerHasSignRequest computed (true when the current user has a

signRequestId) and pass it to requirementValidator.getFirstUnmetRequirement()

in both confirmSignDocument and executeSigningAction so the validator can

prompt for the signature drawing even when no element box was placed.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>

[skip ci]
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos marked this pull request as ready for review March 5, 2026 15:59
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos merged commit 34e9fe6 into stable32 Mar 5, 2026
46 checks passed
@vitormattos vitormattos deleted the backport/2595/stable32 branch March 5, 2026 16:21
@github-project-automation github-project-automation bot moved this from 0. Needs triage to 4. to release in Roadmap Mar 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: 4. to release

Development

Successfully merging this pull request may close these issues.

1 participant