Commit graph

10548 commits

Author SHA1 Message Date
Vitor Mattos
4f46ee6d44
Merge pull request #6210 from LibreSign/feat/add-twig-documentation-links
feat: add Twig documentation links to template editors
2025-12-16 10:12:18 -03:00
Vitor Mattos
8b6a0da085
feat: add Twig documentation links to template editors
Add clickable links to Twig documentation (https://twig.symfony.com/)
in both Signature Stamp and Footer Template editor sections using
the v-linkify directive from @nextcloud/vue.

This improves user experience by providing direct access to Twig
syntax documentation when configuring custom templates.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-16 09:52:33 -03:00
Vitor Mattos
0249686c1e
Merge pull request #6207 from LibreSign/fix/improve-responsive-mode
fix: improve responsive mode
2025-12-16 09:24:10 -03:00
Vitor Mattos
a965212346
fix: improve responsive mode
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-16 09:20:27 -03:00
Vitor Mattos
cc870409de
Merge pull request #6204 from LibreSign/feat/improve-error-page-layout
feat: improve error page layout
2025-12-16 09:16:19 -03:00
Nextcloud bot
9b85856c79
fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2025-12-16 02:29:27 +00:00
Vitor Mattos
8eb60247f3
chore: remove unecessary comments
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 20:40:32 -03:00
Vitor Mattos
42c29a96d3
chore: remove unused file
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 20:39:44 -03:00
Vitor Mattos
30df54a426
feat: improve error page layout and mobile responsiveness
- Replace sad face icon with alert icon
- Add LibreSign logo header
- Use NcEmptyContent component
- Add card container with shadow
- Improve mobile responsiveness
- Clean up CSS and remove redundant styles

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 20:37:44 -03:00
Vitor Mattos
2f1e10bfc2
Merge pull request #6201 from LibreSign/fix/filter-ca-id-and-config-path-in-api
fix: prevent stale configPath and CA ID exposure in root certificate API
2025-12-15 19:20:21 -03:00
Vitor Mattos
54f73ed475
refactor: add centralized reset in getMockAppConfig for test isolation
- Add reset() method to AppConfigOverwrite that clears overWrite and deleted arrays and returns self
- Integrate reset() directly into getMockAppConfig() to ensure clean state on every call
- All tests now automatically get clean AppConfig state without explicit reset calls
- Prevents state pollution across test suites by resetting at the source
- Simplifies test code by removing need for separate reset wrapper method

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 19:11:06 -03:00
Vitor Mattos
3d4bdf0294
fix: filter CA ID from OU only when certificate not generated
The CA ID (libresign-ca-id:...) in OrganizationalUnit should only be
filtered out when the certificate is not generated (isSetupOk() returns
false). When the certificate is successfully generated, the CA ID must
be preserved in the API response.

This ensures:
- Generated certificates: CA ID is visible (expected behavior)
- Failed/not generated: CA ID is filtered to prevent stale data in form

Integration tests validated:
- features/account/signature.feature:2 (OpenSSL)
- features/account/signature.feature:23 (CFSSL)
- features/admin/certificate_openssl.feature:2
- features/admin/certificate_openssl.feature:35

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 17:39:24 -03:00
Vitor Mattos
65ac52b309
test: clean up config_path in AEngineHandlerTest setUp
Prevent test state pollution by ensuring config_path is deleted
in setUp(). This fixes failures in OpenSslHandlerTest where the
temporary config path from AEngineHandlerTest was persisting
through the shared appConfig mock, causing tests that expect
properly formatted PKI directory names to fail.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 17:20:48 -03:00
Vitor Mattos
249f0837b0
fix: prevent stale configPath and CA ID exposure in root certificate API
Filter configPath from API response when certificate is not generated to prevent
form pre-population with outdated generation numbers that cause validation errors.

Filter CA ID (libresign-ca-id:*) from OrganizationalUnit field to prevent users
from submitting stale generation values that conflict with certificate validation.

Refactor toArray() method by extracting logic into dedicated methods:
- getConfigPathForApi(): Returns empty string for non-generated certificates
- removeCaIdFromOrganizationalUnit(): Filters CA IDs from OU arrays

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 16:57:17 -03:00
Vitor Mattos
2d3f820a1f
Merge pull request #6197 from LibreSign/refactor/consolidate-pdf-fixtures
refactor: consolidate pdf fixtures
2025-12-15 16:10:41 -03:00
Vitor Mattos
595bf2d937
chore: update PDF paths in REUSE.toml
Update paths to reflect new organization in pdfs/ subdirectory:
- tests/php/fixtures/real_jsignpdf_level1.pdf -> tests/php/fixtures/pdfs/real_jsignpdf_level1.pdf
- tests/php/fixtures/small_valid-signed.pdf -> tests/php/fixtures/pdfs/small_valid-signed.pdf
- tests/php/fixtures/small_valid.pdf -> tests/php/fixtures/pdfs/small_valid.pdf

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 16:06:04 -03:00
Vitor Mattos
5618b286e5
fix: update PDF path in DevelopController
Update path from tests/php/fixtures/small_valid.pdf to
tests/php/fixtures/pdfs/small_valid.pdf after file reorganization.

Fixes /apps/libresign/develop/pdf route.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 16:02:35 -03:00
Vitor Mattos
c8e9a2d4b1
fix: year
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 15:56:34 -03:00
Vitor Mattos
77dfe0a49c
fix: cs
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 15:56:28 -03:00
Vitor Mattos
80ab7e6560
chore: add REUSE headers to catalog.yaml
Add SPDX license and copyright headers to comply with REUSE specification.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 15:56:06 -03:00
Vitor Mattos
9274075bf8
chore: update dependencies and handler
Update composer.json and Pkcs12Handler changes from refactoring.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 15:53:02 -03:00
Vitor Mattos
4d23cd91aa
chore(test): remove old PDF fixtures
Delete PDFs from root fixtures directory.
Files now organized in tests/php/fixtures/pdfs/ with catalog.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 15:52:53 -03:00
Vitor Mattos
7bc88482a8
feat(test): add PdfFixtureCatalog for real signed PDFs
Create catalog system for managing real-world signed PDFs:
- PdfFixtureCatalog class with YAML-based metadata
- Filter by DocMDP level, TSA, signature tool, count
- Provides expected validation results for tests
- Includes PdfFixture wrapper for easy access
- Store real PDFs in tests/php/fixtures/pdfs/ directory

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 15:52:45 -03:00
Vitor Mattos
3f26b2bc24
test: reduce verbosity in Pkcs12HandlerTest
Clean up test code by:
- Removing verbose docblocks and obvious comments
- Simplifying assertion messages
- Deleting 2 redundant tests (extraction and validation)
- Reducing file size from 180 to 46 lines (74% reduction)

All 21 tests still pass with maintained coverage.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 15:52:35 -03:00
Vitor Mattos
04f393b9a6
refactor(test): migrate API controller tests to PdfGenerator
Replace PdfFixtureTrait with PdfGenerator in API tests:
- FileControllerTest
- FileElementControllerTest
- IdDocsControllerTest
- NotifyControllerTest
- RequestSignatureControllerTest
- SignFileControllerTest

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 15:52:25 -03:00
Vitor Mattos
819eca3ab1
refactor(test): migrate Unit tests to use PdfGenerator
Replace PdfFixtureTrait usage with PdfGenerator static methods:
- Remove 'use PdfFixtureTrait' statements
- Add 'use OCA\Libresign\Tests\Fixtures\PdfGenerator' imports
- Change trait method calls to static PdfGenerator:: calls
- Fix incorrect PdfGenerator::createMock() to $this->createMock()

Affected test files:
- DocMdpHandlerTest
- FileServiceTest (3 createMock fixes)
- SignFileServiceTest (20+ createMock fixes)
- PdfParseServiceTest
- PdfSignatureDetectionServiceTest
- RequestSignatureServiceTest
- ValidateHelperTest
- AEnvironmentPageAwareControllerTest

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 15:52:16 -03:00
Vitor Mattos
a7de549cdf
refactor(test): remove PdfFixtureTrait
Delete trait after migrating all methods to PdfGenerator.
The trait pattern was unnecessary for stateless utility methods.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 15:52:05 -03:00
Vitor Mattos
6f8d4111cc
feat(test): create PdfGenerator class with static methods
Consolidate PDF fixture generation into a single static class:
- Migrate all methods from PdfFixtureTrait to PdfGenerator
- Convert trait methods to public static methods
- Maintain all existing functionality
- Includes 20+ methods for ISO 32000-1 edge case testing

This improves code organization and eliminates trait usage.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 15:49:35 -03:00
Vitor Mattos
54b16f7f5e
Merge pull request #6194 from LibreSign/refactor/change-icon-color
refactor: change icon color
2025-12-15 15:41:39 -03:00
Vitor Mattos
fac0ce33a6
refactor: change icon color
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-15 15:28:53 -03:00
Vitor Mattos
792690ac88
Merge pull request #6191 from LibreSign/fix/fallback-to-initial-value
fix: fallback to initial value
2025-12-15 14:14:48 -03:00
Crisciany Souza
fbe2760a87 fix: fallback to initial value
Signed-off-by: Crisciany Souza <crisciany.souza@librecode.coop>
2025-12-15 12:17:22 -04:00
Nextcloud bot
cac3094c63
fix(l10n): Update translations from Transifex
Signed-off-by: Nextcloud bot <bot@nextcloud.com>
2025-12-15 02:22:35 +00:00
Vitor Mattos
f89ec9bf05
Merge pull request #6187 from LibreSign/feat/docmdp-per-file
feat: docmdp per file
2025-12-14 16:46:25 -03:00
Vitor Mattos
50b66c4f79
fix: unit tests
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 16:38:34 -03:00
Vitor Mattos
3beca7f23e
chore: add docblock of openapi.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 16:38:34 -03:00
Vitor Mattos
d23ae7b51c
fix: cs
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 16:38:34 -03:00
Vitor Mattos
114b4eabd1
test: fix unit tests for DocMDP per-file feature
- Add docmdpLevel to LibresignValidateFile schema in ResponseDefinitions
- Add DocMdpConfigService mock to RequestSignatureServiceTest
- Fix constructor parameter order in RequestSignatureServiceTest
- Mock validateDocMdpAllowsSignatures in SignFileServiceTest
- Mock getDocmdpLevelEnum to return NOT_CERTIFIED in test scenarios
- Fixes OpenAPI schema validation errors
- Fixes ArgumentCountError in RequestSignatureService tests
- Fixes enum mocking issues in SignFileService tests

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 16:38:34 -03:00
Vitor Mattos
4073b0c224
chore: bump version
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 16:38:34 -03:00
Vitor Mattos
5689200ba3
feat: show warning when DocMDP prevents adding signers
- Add NcNoteCard warning message for DocMDP level 1
- Add showDocMdpWarning computed property
- Warning only shows when button is hidden
- Prevents UI flash during state transitions
- Uses consistent error message with backend

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 16:38:34 -03:00
Vitor Mattos
99e2c0258a
feat: block adding signers when DocMDP level 1 is set
- Add isDocMdpNoChangesAllowed() method to files store
- Update canAddSigner() to check DocMDP level 1 with existing signers
- Only blocks after first signer is added (not before)
- Encapsulates logic in reusable method

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 16:38:34 -03:00
Vitor Mattos
c43159c777
feat: include docmdpLevel in API responses
- Add docmdp_level to SELECT and GROUP BY in SignRequestMapper
- Format docmdpLevel as integer in API response
- Add docmdpLevel to FileService::loadLibreSignData()
- Ensures frontend receives per-file DocMDP configuration

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 16:38:34 -03:00
Vitor Mattos
8acb7f8576
feat: validate DocMDP per file before signing
- Update validateDocMdpAllowsSignatures() to check file's docmdpLevel first
- Falls back to PDF extraction for legacy files (level 0)
- Throws consistent error message for DocMDP level 1
- Prevents adding signatures to certified documents with no changes allowed

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 16:38:34 -03:00
Vitor Mattos
cff28b6ceb
feat: save DocMDP level from global config to file on creation
- Add DocMdpConfigService dependency to RequestSignatureService
- Create setDocMdpLevelFromGlobalConfig() method
- Save admin DocMDP configuration to file entity on creation
- Allows per-file DocMDP configuration instead of only global

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 16:38:34 -03:00
Vitor Mattos
3a026f5c10
feat: add docmdp_level column to libresign_file table
- Add migration to create docmdp_level column (SMALLINT, default 0)
- Add docmdpLevel property to File entity with getters/setters
- Add getDocmdpLevelEnum() and setDocmdpLevelEnum() methods
- DocMDP levels: 0=not certified, 1=no changes, 2=form fill, 3=annotations

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 16:38:34 -03:00
Vitor Mattos
7a542b3a88
Merge pull request #6184 from LibreSign/refactor/extract-status-services
refactor: extract status services
2025-12-14 14:02:58 -03:00
Vitor Mattos
3d9652487c
test: update SequentialSigningServiceTest after IAppConfig removal
Removed IAppConfig mock from test setup to match updated
service constructor signature.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 14:00:30 -03:00
Vitor Mattos
d5e3cae60c
refactor: remove unused IAppConfig dependency from SequentialSigningService
IAppConfig was injected but never used in any method.
Removed dependency to clean up constructor.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 14:00:30 -03:00
Vitor Mattos
30c4612419
fix: cs
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 13:53:52 -03:00
Vitor Mattos
911af0d300
test: update RequestSignatureService tests for new architecture
Updated tests to inject FileStatusService and SignRequestStatusService
mocks. Added specific tests validating parallel and ordered flow
behavior with correct parameter ordering for determineInitialStatus.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
2025-12-14 13:53:33 -03:00