{"result":{"depiction_url":null,"edges":{"observes":{"objects":[{"created":"2026-10-20T12:30:42Z","object_id":{"id":1468,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_acl_is_allowed","title":"observe_acl_is_allowed\/2","uri":"https:\/\/zotonic.com\/id\/1468"},"seq":1},{"created":"2026-10-20T12:30:42Z","object_id":{"id":1469,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_acl_is_allowed_prop","title":"observe_acl_is_allowed_prop\/2","uri":"https:\/\/zotonic.com\/id\/1469"},"seq":2},{"created":"2026-10-20T12:30:42Z","object_id":{"id":2020,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_url_rewrite","title":"observe_url_rewrite\/3","uri":"https:\/\/zotonic.com\/id\/2020"},"seq":3},{"created":"2026-10-20T12:30:42Z","object_id":{"id":2319,"is_a":["text","documentation","reference","notification"],"name":"doc_notification_middleware","title":"observe_middleware\/3","uri":"https:\/\/zotonic.com\/id\/2319"},"seq":4}],"predicate":{"id":2550,"is_a":["meta","predicate"],"name":"observes","title":{"_type":"trans","tr":{"en":"Observes"}},"uri":"https:\/\/zotonic.com\/id\/observes"}},"subject":{"objects":[{"created":"2026-10-20T12:30:42Z","object_id":{"id":2555,"is_a":["categorization","keyword","keyword_information_type"],"name":"zotonic_topic_reference","title":"Reference","uri":"https:\/\/zotonic.com\/id\/2555"},"seq":1},{"created":"2026-10-20T12:30:42Z","object_id":{"id":2562,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_site_administrator","title":"Site administrator","uri":"https:\/\/zotonic.com\/id\/2562"},"seq":2},{"created":"2026-10-20T12:30:42Z","object_id":{"id":2563,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_frontend_developer","title":"Frontend developer","uri":"https:\/\/zotonic.com\/id\/2563"},"seq":3},{"created":"2026-10-20T12:30:42Z","object_id":{"id":2564,"is_a":["categorization","keyword","keyword_audience"],"name":"zotonic_topic_backend_developer","title":"Backend developer","uri":"https:\/\/zotonic.com\/id\/2564"},"seq":4},{"created":"2026-10-20T12:30:42Z","object_id":{"id":2592,"is_a":["categorization","keyword","keyword_domain"],"name":"zotonic_topic_authorization_and_access_control","title":"Authorization and access control","uri":"https:\/\/zotonic.com\/id\/2592"},"seq":5},{"created":"2026-10-20T12:30:42Z","object_id":{"id":2635,"is_a":["categorization","keyword","keyword_architecture"],"name":"zotonic_topic_module","title":"Module","uri":"https:\/\/zotonic.com\/id\/2635"},"seq":6},{"created":"2026-10-20T12:30:42Z","object_id":{"id":2667,"is_a":["categorization","keyword","keyword_data_type"],"name":"zotonic_topic_url","title":"URL","uri":"https:\/\/zotonic.com\/id\/2667"},"seq":7},{"created":"2026-10-20T12:30:42Z","object_id":{"id":2685,"is_a":["categorization","keyword","keyword_quality"],"name":"zotonic_topic_security","title":"Security","uri":"https:\/\/zotonic.com\/id\/2685"},"seq":8}],"predicate":{"id":308,"is_a":["meta","predicate"],"name":"subject","title":{"_type":"trans","tr":{"en":"Keyword"}},"uri":"http:\/\/purl.org\/dc\/elements\/1.1\/subject"}}},"id":3094,"is_a":["text","documentation","reference","module"],"links":[{"rel":"self","target":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/3094"},{"rel":"hub","target":"https:\/\/zotonic.com\/.zotonic\/websub"}],"medium":null,"medium_url":null,"name":"doc_external_5_mod_access_url","page_url":{"en":"https:\/\/zotonic.com\/docs\/3094\/mod_access_url","x-default":"https:\/\/zotonic.com\/docs\/3094\/mod_access_url"},"preview_url":null,"resource":{"version":25,"pivot_location_lat":null,"title":"mod_access_url","is_authoritative":true,"body":"<p>Share protected pages, images and feeds using signed URLs with the signing user&#39;s\nview permissions. Recipients do not need to log in as that user. Typical uses\ninclude private calendar feeds, HTML certificate rendering and sharing a survey\nwith people who do not have an account.<\/p>\n<h2>Setup and administration<\/h2>\n<p>Install the <code>zotonic_mod_access_url<\/code> application and enable <code>mod_access_url<\/code> for\nthe site. The module adds a <strong>Share link to this page<\/strong> widget to the admin edit\nsidebar. An authenticated user who can view the resource can generate and copy\na link, choosing a duration or an indefinite link.<\/p>\n<p>There are no module configuration keys. Signing secrets are created on demand\nas <code>mod_access_url<\/code> identities associated with the signing user.<\/p>\n<h2>Generate a signed URL<\/h2>\n<p>Add <code>z_access_url<\/code> to a dispatch URL generated in an authenticated context:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-django\">{% url page id=id z_access_url absolute_url %}\n<\/code><\/pre>\n<p>To make the link valid for one hour:<\/p>\n<pre class=\"notranslate\"><code class=\"notranslate language-django\">{% url page id=id z_access_url z_access_url_valid_for=3600 absolute_url %}\n<\/code><\/pre>\n<p><code>z_access_url_valid_for<\/code> accepts an integer duration in seconds or a binary date\nexpression understood by <code>z_datetime:to_datetime\/1<\/code>, such as <code>+day<\/code> or <code>+week<\/code>.\nOmitting it creates a link without an expiry. The generated query contains the\nabsolute expiry timestamp; do not pass that timestamp back as an integer duration.<\/p>\n<p>The same arguments can be passed to <code>z_dispatcher:url_for\/3<\/code>, or set on a context\nwhen generating resource page URLs. <code>m_access_url:generate_url\/2,3<\/code> provides a\nconvenience API for absolute resource URLs. See <code>m_access_url<\/code> for model calls.<\/p>\n<p>An integer <code>z_access_url<\/code> selects another signing user only when the caller can\nedit that user&#39;s resource. Signing explicitly for user 1 requires the caller to\nbe user 1. Without a signing user, the URL is returned unsigned.<\/p>\n<h2>Permissions and respondent identity<\/h2>\n<p>A valid link supplies an additional context for resource and property <strong>view<\/strong>\nchecks. It does not replace the visitor&#39;s logged-in identity or grant edit,\nupdate or delete permissions. Invalid, expired and unknown tokens leave normal\nrequest permissions in effect.<\/p>\n<p>For surveys using the standard submission handler, an anonymous recipient&#39;s\nanswers remain anonymous in the <code>user_id<\/code> column and may be associated with a\nbrowser session. A logged-in recipient&#39;s answers belong to that recipient, not\nthe signer. Survey settings and custom submission handlers still apply; a signed\nlink is not a general authorization to perform writes.<\/p>\n<p>The module runs at priority 10 so its view grants can be evaluated before an ACL\nmodule returns a denial. Custom ACL integrations must preserve that ordering.<\/p>\n<h2>Images, browser sessions and expiry<\/h2>\n<p>Image URLs generated through the <code>image<\/code> dispatch while rendering a validated\naccess URL are signed using the validated signing user. They retain the parent\nlink&#39;s exact expiry, including the absence of an expiry. This allows renderers\nwithout the visitor&#39;s login cookies to fetch protected images.<\/p>\n<p>Resources granted view access can also be registered for the visitor&#39;s session\nfor four hours. These grants allow subsequent requests, such as survey pages,\nto access those resources without resending the original signature. Grants are\nkept in a site-specific ETS table on the current node and are lost when that\ntable is recreated. The four-hour grant period is independent of the signed\nURL&#39;s expiry and can outlast it.<\/p>\n<p>The <code>_html_body.tpl<\/code> contribution uses <code>m.access_url.reload_needed<\/code> to reload a\nsigned page after the Cotonic session cookie becomes available. Custom page\nlayouts should include the standard Zotonic body contributions for this behavior.\nImage signatures themselves do not require a browser session.<\/p>\n<h2>Signature compatibility and diagnostics<\/h2>\n<p>Verification accepts current Base64URL signatures and earlier Base64 signatures.\nLinks without an expiry can also use the historical Erlang-term signatures,\nincluding the old <code>use_absolute_url<\/code> variant. Compatibility checks reconstruct\nserver-side data; they never deserialize a term supplied by the requester.<\/p>\n<p>Failure logs distinguish <code>expired<\/code>, <code>invalid_expiry<\/code>, <code>malformed_signature<\/code>,\n<code>signature_mismatch<\/code> and <code>unknown_user_token<\/code>. Successful verification logs the\nsignature format at debug level. These logs omit tokens, signatures and secrets.\nAdded application parameters, including tracking parameters, invalidate a link.<\/p>\n<h2>Sharing and scope<\/h2>\n<p>Anyone holding a valid link can use it. Share links only with intended recipients\nand avoid exposing them in public pages or logs. The signature binds the dispatch\nand application arguments; language and internal access-URL arguments are handled\nseparately. It does not turn arbitrary links on the page into signed links.\nValidated responses receive a noindex header.<\/p>\n<p>The public <code>register_resource\/2<\/code> helper records a session grant without checking\nACLs itself. Use it only after authorizing access; <code>is_resource_registered\/2<\/code>\nchecks whether that session grant is still valid.<\/p>","slug":"mod_access_url","doc_module_config":[],"is_protected":false,"visible_for":0,"tz":"UTC","language":["en"],"doc_source_hash":"66a08a21370fde286f76a04f0e5d6b5b9164db3ccf99a5d7deb8927011eb5077","doc_module_observers":[{"name":"acl_is_allowed","page_name":"doc_notification_acl_is_allowed"},{"name":"acl_is_allowed_prop","page_name":"doc_notification_acl_is_allowed_prop"},{"name":"middleware","page_name":"doc_notification_middleware"},{"name":"tick_24h","page_name":"doc_notification_tick_24h"},{"name":"url_rewrite","page_name":"doc_notification_url_rewrite"}],"is_featured":false,"content_group_id":{"id":2551,"is_a":["meta","content_group"],"name":"content_group_imported_docs","title":"Imported documentation","uri":"https:\/\/zotonic.com\/id\/content_group_imported_docs"},"external_module_id":{"id":5,"is_a":[],"name":null,"title":null,"uri":"https:\/\/zotonic.com\/id\/5"},"git_url":"https:\/\/github.com\/zotonic\/zotonic_mod_access_url","category_id":{"id":320,"is_a":["meta","category"],"name":"module","title":"Modules","uri":"https:\/\/test.zotonic.com\/id\/320"},"doc_source_path":".\/src\/mod_access_url.erl","publication_start":"2026-10-20T12:30:42Z","github_url":"https:\/\/github.com\/zotonic\/zotonic_mod_access_url","pivot_location_lng":null,"doc_source_kind":"external","name":"doc_external_5_mod_access_url","is_unfindable":false,"is_published":true,"pivot_geocode":null,"external_module_title":"Access URLs","created":"2026-10-20T12:30:42Z","uri":null,"doc_status":"current","is_dependent":false,"is_external_module":true,"publication_end":"9999-06-01T00:00:00Z","modifier_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"privacy":0,"doc_source_commit":"1f353ae6249143f0a1ae35b298a6210170607f71","creator_id":{"id":1,"is_a":["person"],"name":"administrator","title":"Site Administrator","uri":"https:\/\/zotonic.com\/id\/1"},"modified":"2026-10-20T12:30:42Z","title_slug":"mod_access_url"},"uri":"https:\/\/zotonic.com\/id\/3094","uri_template":"https:\/\/zotonic.com\/id\/:id","websub":{"hub":"https:\/\/zotonic.com\/.zotonic\/websub","topic":"https:\/\/zotonic.com\/.zotonic\/websub\/topic\/3094"}},"status":"ok"}