https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42952

--- Comment #10 from Mark Hofstetter <[email protected]> ---
Created attachment 206026
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=206026&action=edit
Bug 42952: Add public SRU configuration

Add opt-in OPAC visibility rules for bibliographic requests received by
the shared Z39.50/SRU responder when Elasticsearch is used. Suppressed
and OPAC-hidden records are not exposed. A direct numeric rec.id request
returns a suppression diagnostic only when OpacSuppressionRedirect uses
the blocked-record response; otherwise it returns no hit.

Add PublicSRUXSLT for optional MARCXML transformations after OPAC MARC
filtering. Include a demo stylesheet that returns only 245$a, and return
a temporary diagnostic when a stylesheet fails or does not return MARCXML.

Document the configuration and add tests for all preference, suppression,
redirect, IP-range, OPAC-hidden-item, XSLT, and Elasticsearch cases.

Test plan:
1. Apply the patch, run database updates, and use Elasticsearch.
2. Restart the responder after changing preferences:
   koha-z3950-responder --restart kohadev
3. Use visible biblio 1 and set biblio 191 to opac_suppressed.
4. Set PublicSRU to Use, OpacSuppression to Hide, clear
   OpacSuppressionByIPRange, set OpacSuppressionRedirect to the not-found
   setting, and leave PublicSRUXSLT empty.
5. Confirm that a visible biblio returns OPAC-filtered MARCXML:
   docker exec ktdmaster-koha-1 curl -sS -G 'http://127.0.0.1:2100/biblios' \
     --data-urlencode 'version=1.1' \
     --data-urlencode 'operation=searchRetrieve' \
     --data-urlencode 'query=rec.id=1' \
     --data-urlencode 'recordSchema=marcxml' \
     --data-urlencode 'recordPacking=xml' \
     --data-urlencode 'maximumRecords=1'
6. Confirm that a direct request for the suppressed biblio returns no hit
   and does not disclose suppression:
   docker exec ktdmaster-koha-1 curl -sS -G 'http://127.0.0.1:2100/biblios' \
     --data-urlencode 'version=1.1' \
     --data-urlencode 'operation=searchRetrieve' \
     --data-urlencode 'query=rec.id=191' \
     --data-urlencode 'recordSchema=marcxml' \
     --data-urlencode 'recordPacking=xml' \
     --data-urlencode 'maximumRecords=1'
7. Confirm that a normal search cannot disclose the suppressed biblio:
   docker exec ktdmaster-koha-1 curl -sS -G 'http://127.0.0.1:2100/biblios' \
     --data-urlencode 'version=1.1' \
     --data-urlencode 'operation=searchRetrieve' \
     --data-urlencode 'query=rec.id=1 or rec.id=191' \
     --data-urlencode 'recordSchema=marcxml' \
     --data-urlencode 'recordPacking=xml' \
     --data-urlencode 'maximumRecords=10'
8. Enable the blocked-record OpacSuppressionRedirect setting and repeat
   the direct request. It must contain Record is suppressed. The normal
   search must still hide biblio 191.
9. Set OpacSuppressionByIPRange to 127\\.0\\.0\\. and repeat the direct
   request from the container. It must return biblio 191. Disable
   OpacSuppression and confirm that the biblio also remains visible.
10. Set PublicSRUXSLT to
    /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim245a.xsl,
    restart the responder, and confirm that the visible biblio has only
    245$a in its MARCXML. Verify an invalid stylesheet returns the
    temporary MARCXML transformation diagnostic.
11. Configure an OpacHiddenItems rule and a matching item. Confirm that
    it is not exposed, including from an IP-range exception.
12. Confirm the shared responder behaviour over Z39.50:
    printf '%s\n' 'base biblios' 'find @attr 1=12 191' 'show 1' 'quit' | \
      docker exec -i ktdmaster-koha-1 yaz-client 127.0.0.1:2100
13. Run:
    prove -v t/Koha/Z3950Responder/PublicSRU.t
    prove -v t/db_dependent/Koha/Z3950Responder/GenericSession.t

Co-authored-by: OpenAI Codex <[email protected]>
Sponsored-by: Steiermärkische Landesbibliothek

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to