[FIX] sign_oca: fix public access, iframe assets, and multi-page fields#153
Open
[FIX] sign_oca: fix public access, iframe assets, and multi-page fields#153
Conversation
Contributor
|
Hi @etobella, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #146
Summary
This PR addresses three related issues that prevent the sign_oca portal signing flow from working correctly in Odoo 17:
Public user ACL error — External signers accessing token-based URLs (
/sign_oca/document/<id>/<token>) without logging in receiveAccess Denied by ACLs for operation: readonsign.oca.request.signer. This is because no ACL entries exist forbase.group_public.Iframe asset redirect loop (sign_oca: ERR_TOO_MANY_REDIRECTS #146) — The
sign_oca.sign_assetsbundle contains only SCSS/CSS, butpostIframeFields()injected both a<link>and a<script>tag for it. The JS request to a CSS-only bundle causesERR_TOO_MANY_REDIRECTSin Odoo 17's asset pipeline, preventing the signing page from loading.Multi-page field persistence — After interacting with sign fields on one page and scrolling to another, fields become unresponsive. pdfjs re-renders pages on scroll, destroying field overlays. The
reviewFields()polling only checked a marker div on page 1, so fields on other pages were never re-injected. Additionally, pdfjs'stextLayerintercepted pointer events, blocking clicks on sign field overlays.Changes
Security (
ir.model.access.csv,security.xml)base.group_publiconsign.oca.requestandsign.oca.request.signerbase.group_public(real access control is token-based at the controller level)Backend (
sign_oca_request.py)get_info()to usesudo()forto_signcomputation, with a fallback for public users whose partner won't match any signertemplate_name.pdfinstead of the raw field namedata)Controller (
main.py)get_sign_resourcesfor when the bundle has no assets of the requested type (returns empty response instead of crashing/redirecting)Frontend (
sign_oca_pdf_common.esm.js)<script>tag injection into the iframe (bundle is CSS-only)<link>tag is only injected oncez-indexandpointer-eventsto ensure sign fields render above pdfjs layersreviewFields()to check each field'sel.isConnectedindividually instead of a single marker div on page 1Frontend (
signature.esm.js)dispatchEventinuploadSignatureto prevent cascade TypeErrorCSS (
sign.scss)z-index: 10andcursor: pointerto.o_sign_oca_fieldSteps to reproduce (before fix)
sign_ocaon Odoo 17Testing