Skip to content

Conversation

@backportbot-libresign
Copy link

@backportbot-libresign backportbot-libresign bot commented Dec 3, 2025

Backport of #4464

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 29 commits December 3, 2025 01:25
Signed-off-by: Vitor Mattos <vitor@php.rio>
Introduces new IdDocs system to manage identification documents
for digital signatures, replacing the AccountFile system.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Creates libresign_id_docs table and migrates data from
libresign_account_file to the new structure.

Addresses: #2884, #5260

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Adds REST API endpoints for ID documents management:
- POST /api/v1/id-docs - Add identification documents
- DELETE /api/v1/id-docs - Delete document
- GET /api/v1/id-docs - List documents
- GET /api/v1/id-docs/approval/list - List documents pending approval

Updates PageController route from /account/files to /id-docs

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Updates all service layer code to use IdDocsMapper:
- AccountService: replace AccountFileMapper with IdDocsMapper
- SignFileService: update validation to use IdDocs
- ValidateHelper: migrate document validation logic
- FolderService: add IUser object handling
- Remove AccountFile dependencies from AccountController

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Updates File entity and related controllers to work with IdDocs
instead of AccountFile references.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Rename AccountValidation to IdDocsValidation component
- Update router paths from /docs/accounts to /docs/id-docs
- Update route names: DocsAccountValidation -> DocsIdDocsValidation
- Update action handlers to use IdDocsApprove route
- Update LeftSidebar navigation links

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add IdDocsServiceTest with comprehensive test coverage
- Update ValidateHelperTest, AccountServiceTest and SignFileServiceTest
- Remove AccountFileServiceTest
- Fix test mocks to work with IdDocsMapper

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Create IdDocsControllerTest with tests for new endpoints
- Update AccountControllerTest removing deprecated tests
- Ensure all API endpoints are properly tested

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Updates OpenAPI spec and TypeScript types to reflect:
- New IdDocs endpoints
- Removed AccountFile endpoints
- Fixed complex filter parameter warnings

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add missing psalm-import-type for LibresignPagination and LibresignFile
- Add #[Override] attributes to migration methods
- Fix timestamp conversion using getTimestamp() method
- Fix signRequestId type from string to int
- Fix filter parameter type from string to array<string, mixed>
- Fix typo: singRequestId -> signRequestId

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Change pattern name from 'identifier' to 'userId' to match tests
- Initialize folderName as empty array instead of null
- Maintain support for both IUser objects and string identifiers

Fixes test failures in FolderServiceTest::testGetFolderName

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Auto-formatted import order by IDE/linter.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
When signing as unauthenticated user, $user is null and $user?->getUID()
returns null. The getIdentificationDocumentsStatus() method expects a
string parameter, so we need to use null coalescing operator to provide
empty string as fallback.

Fixes integration test failures:
- request.feature:420
- request.feature:479
- signed.feature:169

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Replace complex array filter parameter with individual scalar parameters
(userId, signRequestId) following Nextcloud's pattern from FileController.

This resolves OpenAPI documentation warnings about complex types in query
parameters while maintaining backward compatibility with existing frontend
code that uses uuid parameter (handled by RequireSignRequestUuid middleware).

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Update OpenAPI specification to reflect the new scalar parameters
(userId, signRequestId, page, length) in IdDocs endpoints.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Replace PHPDoc type annotations with native PHP 8.2 typed properties
for better type safety and modern code standards.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add backup of libresign_account_file table to CSV before migration
and drop the table after successful migration to libresign_id_docs.

The backup file is stored in appdata/libresign/ for data recovery
if needed.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Initialize fileId and fileType with default values to prevent
'must not be accessed before initialization' errors with typed
properties in PHP 8.2.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Regenerate TypeScript types to reflect the new scalar parameters
(userId, signRequestId) instead of the filter parameter.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Remove unnecessary comments that don't add value to code understanding.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Remove unused baseline entry for UndefinedDocblockClass in
Version8000Date20231103003922 migration file.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Remove exception that allowed users with approval permissions to sign
without identification documents. When the identification documents
feature is enabled, all users must have an approved document to sign,
regardless of their permissions.

This simplifies the flow and ensures consistency in document validation.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add @psalm-suppress UndefinedDocblockClass annotation to dropTable call
in Version8000Date20231103003922 migration. The error occurs because Psalm
infers Doctrine\DBAL\Schema\Schema type from ISchemaWrapper docblock, but
this is a Nextcloud core method and the suppression is safe.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Replace deprecated icon-* CSS classes with NcButton components
and vue-material-design-icons for proper icon display.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Change DELETE route from /api/v1/id-docs to /api/v1/id-docs/{nodeId}
following Nextcloud patterns for RESTful resource deletion.
Rename method from deleteFile to delete for clarity.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add nodeId, status, statusText, and file_type.key to the top level

of the response object to match frontend expectations in Documents.vue.

This allows the component to access document properties directly

without nested object navigation.

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

[skip ci]
Remove custom ProgressBar component as all usages have been
replaced with native NcLoadingIcon component.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Replace window.open with router.push for same-window navigation
- Add UUID validation from doc.file.uuid fallback to doc.uuid
- Add error message if UUID is not found

Note: IdDocsApprove route currently uses SignPDF component which
may not be the intended flow for document approval.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- IdDocsService: Create SignRequest and IdentifyMethod when uploading ID document
- SignFileService: Remove on-demand SignRequest creation logic
- Simplify getSignRequestToSign to only find existing requests

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Remove unused signRequestId filter from query
- Unify user join logic (leftJoin when no filter, join when filtering)
- Keep signRequestId column populated when saving IdDocs

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add IdDocsMapper deletion in FileService::delete() to prevent orphaned records

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add initIdDocsApprove() to handle ID document validation workflow

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add NcActions with validate and delete buttons
- Hide validate button when document is already signed (status === 4)
- Add deleteDocument method to remove ID documents
- Use proper Nextcloud components and icons

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add beforeRouteLeave navigation guard to ensure sidebar closes
when navigating away from ID document approval screen.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Use UUIDUtil::getUUID() instead of OCP\Util (consistent with codebase)
- Change setMandatory parameter from true to 1 (expects int not bool)
- Add IdDocsService and SignFileService to psalm baseline for UUIDUtil

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add :force-menu="true" to keep actions menu always visible
- Add View button with EyeIcon to navigate to validation page
- Add Validate button (hidden when status is 4/signed)
- Add Delete button with DeleteIcon
- Remove redundant View PDF button (merged with View)
- Use router.push for in-app navigation

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add :inline="2" to show first 2 buttons inline
- Add :force-name="true" to display button labels
- Keep standard NcActions dropdown behavior for remaining actions

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Replace CheckIcon with PencilIcon to better represent the action
of signing the ID document for approval

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add NcAvatar as first column showing document owner
- Display owner name in second column
- Reorder columns: Avatar, Owner, Type, Status, Actions
- Add blank header cell for avatar column

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add 'Approved by' column showing who validated/signed the document
- Display avatar and name of the signer who completed sign_date
- Show '-' when document hasn't been signed yet

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Change condition from doc.status to doc.file?.status
- Check for status !== 3 (signed) instead of !== 4
- Fixes Sign button appearing on already signed documents

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add getUserConfigIdDocsFilters() method to load user filter preferences
- Move admin permission check into getUserConfigCrlFilters() and getUserConfigCrlSort()
- Simplify getConfig() by removing redundant conditionals
- Each getUserConfig*() method now handles its own validation and default values

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add Owner and Status filters with NcActions toolbar
- Implement filter persistence using userConfigStore
- Apply CRL table structure with frozen columns and sticky headers
- Filters saved automatically with 500ms debounce
- Load saved filters from user config on mount

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add IL10N injection to IdDocsMapper for proper translation support
- Change status text from generic 'available for signature' to context-specific messages
  - Status 1 (STATUS_ABLE_TO_SIGN): 'waiting for approval'
  - Status 3 (STATUS_SIGNED): 'approved'
- Helps users better understand their document state in the approval workflow

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Modified /api/v1/file/list endpoint to return identification document settings
- Settings are extracted from first file (global per user, not per file)
- Enables file list flow to have settings available without additional requests
- Complements direct URL flow for comprehensive coverage

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add null coalescing operator to handle potential null return from getTextOfStatus()
- Fixes Psalm InvalidNullableReturnType and NullableReturnStatement errors

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Change from array[] to array<string, mixed> for more accurate type
- Fixes Psalm InvalidReturnType and InvalidReturnStatement errors

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Import useIdentificationDocumentStore in files.js
- Process settings from /api/v1/file/list response
- Update identificationDocumentStore when file list is loaded
- Enables proactive identification document detection for file list flow

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Change title from 'Your profile documents' to 'Identification Documents'
- Makes component suitable for use in both profile page and sign flow

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos marked this pull request as ready for review December 3, 2025 01:41
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos merged commit 6792071 into stable31 Dec 3, 2025
62 checks passed
@vitormattos vitormattos deleted the backport/4464/stable31 branch December 3, 2025 02:30
@github-project-automation github-project-automation bot moved this from 0. Needs triage to 4. to release in Roadmap Dec 3, 2025
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.

2 participants