Integrate vuedraggable to enable drag-and-drop reordering when in
ordered_numeric mode. Track originalOrders during drag operations,
recalculate signingOrder using shared mixin logic, emit
signing-order-changed event to trigger auto-save. Include CSS
animations and visual feedback for drag states.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Display counter-number badge with highlighted style when in
ordered_numeric mode. Show DragVertical icon handle when drag-and-drop
is enabled. Add closeActions method to programmatically close action
menu after input submission.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Auto-assign incrementing signingOrder to new signers in ordered_numeric
mode. When deleting a signer, decrement signingOrder of subsequent
signers to close gaps and maintain sequential ordering.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add signingOrderMixin.js with recalculateSigningOrders and
normalizeSigningOrders methods to centralize signing order
calculations and normalization logic used by both drag-and-drop
and manual input components.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Include signingOrder field in signer data returned by FileService.
Sort signers by signingOrder (ascending) and displayName as secondary
sort to maintain consistent ordering in the UI.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add signature_flow to initial state in PageController and
TemplateLoader to enable frontend components to access the
current signature flow mode (parallel or ordered_numeric).
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Install vuedraggable v2.24.3 to enable drag-and-drop
functionality for signing order management in sequential
signature flows.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Regenerate OpenAPI documentation files to include the new
signature flow configuration endpoint.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Create SignatureFlow.vue component for admin settings to configure
signing order mode. Administrators can choose between:
- Simultaneous (Parallel): all signers receive at the same time
- Sequential: signers organized by order number
The component follows the same pattern as other admin settings
(DocMDP) with radio buttons, loading states, and error handling.
Integrated into Settings.vue admin panel.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add setSignatureFlowConfig() method to AdminController to allow
administrators to configure the signature flow mode (parallel or
ordered_numeric). The endpoint validates the mode using the
SignatureFlow enum and deletes the config key when parallel mode
is selected (as it's the default).
Endpoint: POST /api/v1/admin/signature-flow/config
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add __call callbacks to SignRequest mocks in both tests to properly return
fileId and signingOrder values. Without these callbacks, the mocks were
returning null when these magic methods were called, causing
SequentialSigningService::releaseNextOrder() to fail with a TypeError.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add reorderAfterDeletion method to SequentialSigningService
- Automatically activate next order when a signer is deleted
- Prevents gaps in signing sequence that would block workflow
- Call reorderAfterDeletion in unassociateToUser after deletion
- Ensures sequential flow continues even when signers are removed
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add getFileId and getSigningOrder to __call callback mocks
- Return 1 for both methods in tests
- Fixes TypeError when releaseNextOrder is called with null fileId
- All 12 affected tests now pass
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add SequentialSigningService mock in RequestSignatureServiceTest
- Add SequentialSigningService mock in SignFileServiceTest
- Update constructor calls in both test files to include new dependency
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Change SignRequestStatus enum from string-backed to int-backed (0, 1, 2)
- Update database migration to use SMALLINT instead of VARCHAR(20)
- Update SignRequest entity to use int type for status property
- Reduces storage overhead and improves performance
- Integer values: 0=draft, 1=able_to_sign, 2=signed
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Test parallel signing: all signers can sign immediately
- Test sequential signing: order enforced, status transitions validated
- Verify status 422 when signer attempts to sign out of order
- Verify status changes from DRAFT to ABLE_TO_SIGN after previous signer completes
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Validate signer cannot sign if status is DRAFT
- Validate signer cannot sign again if already SIGNED
- Use getStatusEnum() for enum comparisons
- Proper error messages for blocked signers
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Mark SignRequest as SIGNED using setStatusEnum()
- Update next signer status after successful signature
- Integrate with SequentialSigningService for flow management
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Inject SequentialSigningService dependency
- Reset order counter before processing signers
- Determine signing order for each user
- Set initial status based on order (ABLE_TO_SIGN for first, DRAFT for others)
- Type casting for signingOrder from JSON input
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Manages signing order determination and counter
- Validates signature flow (parallel vs sequential)
- Updates next signer status after signature completion
- Integrates with IAppConfig for flow configuration
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- SignRequestStatus: Enum with DRAFT, ABLE_TO_SIGN, SIGNED states
- SignatureFlow: Enum with PARALLEL and ORDERED_NUMERIC modes
- String-backed enums for database compatibility
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Improve signature request workflow in sidebar:
- Add separate 'Save' and 'Send' buttons with clear actions
- Show 'Edit visible signatures' when elements available
- Hide edit button when document is partially/fully signed
- Add visual icons: Pencil (edit), Send (send), Draw (sign), FileDocument (open)
- Simplify save/request methods using store
- Add status-based button visibility logic using SIGN_STATUS enum
- Improve button naming: 'Request' → 'Send' for clarity
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Refactor VisibleElements to use centralized store methods:
- Replace inline axios calls with store methods
- Add buildVisibleElements helper to construct elements array
- Separate save (status 0) and request (status 1) actions
- Show 'Save' for drafts, 'Send' for requests
- Add Send icon to request button
- Remove confirmation dialog for save action
- Keep confirmation dialog for send action with proper error handling
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Centralize logic for saving and requesting signatures in the filesStore.
This allows reusable methods across different components:
- saveWithVisibleElements: saves draft (status 0)
- requestSignaturesWithVisibleElements: sends request (status 1)
Both methods handle visible elements positioning data.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Replace NcTextArea with CodeEditor component for better Twig
syntax highlighting and code editing experience.
- Remove inline variables list in favor of dialog
- Add 'Available variables' button with help icon
- Use CodeEditor with Twig syntax highlighting
- Apply debounced save on input (500ms)
- Maintain dynamic height with min-height: 80px
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
- Add viewportMargin: Infinity to render all content
- Reduce min-height from 200px to 80px for better UX
- Allow editor to grow dynamically with content
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Use NcRichText component to properly render formatted tips in the
configuration check table, replacing plain text rendering.
This change:
- Imports and uses NcRichText component from @nextcloud/vue
- Enables Markdown rendering for tip content with autolink support
- Adds CSS styling for proper text wrapping and width constraints
- Ensures secure rendering through NcRichText's built-in sanitization
The tips now display with proper formatting including bold text, lists,
code blocks, and clickable links, improving readability and user experience.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Improve the non-UTF-8 encoding detection in ConfigureCheckService to provide
comprehensive diagnostic information when Java reports incorrect encoding.
The enhanced check now:
- Shows the specific encoding detected by Java
- Displays current PHP environment variables (LC_CTYPE, LC_ALL, LANG)
- Provides step-by-step resolution instructions
- Links to issue #4872 with detailed troubleshooting
This helps administrators quickly identify and resolve locale inheritance
issues between PHP and Java that cause character encoding problems in
PDF signatures.
Ref: https://github.com/LibreSign/libresign/issues/4872
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
The identify_methods array was incorrectly annotated as 'array' which
violated OpenAPI documentation standards. Changed to 'array<array<string, mixed>>'
to properly represent a list of non-empty objects.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
When switching from OpenSSL to CFSSL engine without configuring CFSSL,
the configure-check was incorrectly showing 'success' status instead of
'error'. This happened because isSetupOk() only checked for ca.pem and
ca-key.pem files, which are common to both engines and shared in the
same config_path directory.
Now isSetupOk() also verifies the presence of CFSSL-specific files
(csr_server.json and config_server.json) to ensure it's a valid CFSSL
configuration and not just leftover OpenSSL files.
This fix ensures the certificate_engine_switch integration test passes.
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add comprehensive test coverage for configureIdentifyMethodsForEngine
including edge cases and data provider patterns.
Tests validate that 'none' engine correctly configures only account
identification with minimal configuration.
Related to #5145
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add v-if directive to hide IdentificationFactors section when
certificate engine is 'none', and watch identifyMethods to ensure
UI updates reactively when switching engines.
This prevents users from configuring identification methods that
require certificate infrastructure.
Fixes#5145
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Update CertificateEngine component to use store action and emit
event after setup check completes.
This ensures proper timing for cross-component communication.
Related to #5145
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add saveCertificateEngine() action that calls the REST endpoint
and updates both engine and identify_methods state reactively.
Uses axios promise chain pattern for consistency with existing
store actions.
Related to #5145
Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>