Koha-clms/Koha
Tomas Cohen Arazi f1ca5b7473 Bug 24909: Add unprivileged route to get a bibliographic record
This patch adds a route to get bibliographic records without privileged
access. This needs to match the OPAC expected behaviour.

Some things were considered on the implementation:
- The ViewPolicy filter that hides/shows things based on the frameworks
  needded to be used, as in the OPAC.
- OpacHiddenItems and OpacHiddenItemsExceptions need to be considered
  for hiding records the same way the OPAC is expected to.
- Avoid using OpacHiddenItemsExceptions, but rely on the patron category
  instead (use Koha::Patron::Category->override_hidden_items abstraction
  is used instead so it should keep working once 22547 is moved
  forward).
- Tests should cover all the use cases:
  * logged in user
  * anonymous user
  * logged in with category that overrides
  * logged in with category that doesn't override

This is all implemented on the tests.

To test:
1. Apply the tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/api/v1/biblios.t
=> FAIL: Route not implemented
3. Apply the rest of the patches
4. Repeat 2
=> SUCCESS: Tests pass!
5. Try it with your favourite API tool (Postman?)
6. Sign off :-D

Note: please notice there isn't a default fallback behaviour for when
you don't specify the Accept header, so testing this on a regular
browser will just print the accepted mime types instead of the record
itself.

To test this with a tool (like Postman) you should enable
RESTBasicAuthe and make the tool use Basic authentication with valid
credentials. And you need to specify any of the following strings on the
Accept header:
- application/marcxml+xml
- application/marc-in-json
- application/marc
- text/plain

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
(cherry picked from commit b97158dd13)

Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
2020-06-15 10:38:33 +12:00
..
Account Bug 23805: (RM follow-up) Add credit_type relation to Koha::Account::Line 2019-11-20 11:56:41 +00:00
Acquisition Bug 23927: Do not copy invoiceid for a new duplicated order 2019-11-27 09:18:27 +00:00
ArticleRequest
…
Authority
…
Biblio Bug 24827: Standardise on 'UTF-8' as the encoding name 2020-04-03 18:13:57 +00:00
BiblioUtils Bug 24827: Specify UTF-8 as encoding in new_from_xml() 2020-04-03 18:14:07 +00:00
Cache
…
Cash Bug 23321: Allow setting of branch default 2019-09-23 11:39:22 +01:00
Charges Bug 24259: Handle non existing default circ rule in Charges::Fees 2020-01-03 22:23:32 +00:00
Checkouts Bug 14697: Introduce Koha::Checkouts::ReturnClaim(s) 2019-10-31 12:03:33 +00:00
Club Bug 19809: Re-allow to call Koha::Objects::find in list context 2020-02-11 19:27:34 +00:00
Config
…
Edifact Bug 24840: [19.11.x] Replace DateTime->now with dt_from_string 2020-05-07 17:17:12 +00:00
Exceptions Bug 14697: Introduce Koha::Checkouts::ReturnClaim(s) 2019-10-31 12:03:33 +00:00
Exporter Bug 22721: Remove frameworkcode parameter in GetMarcFromKohaField calls 2019-07-15 11:28:08 +01:00
ExternalContent
…
Filter/MARC Bug 25019: Make the ViewPolicy filter initialization standard 2020-05-01 17:37:54 +00:00
Illrequest Bug 23712: Silence warns from Koha/Illrequest/Logger.pm 2019-10-21 09:43:17 +01:00
Indexer
…
Item
…
Library Bug 21910: Does not deal with call context, ->search does already 2018-12-11 19:11:34 +00:00
List
…
MetadataRecord Bug 21872: Remove duplicate modulo condition in authorities iterator 2019-05-10 12:31:49 +00:00
Middleware Bug 24538: Handle Net::Netmask parser errors 2020-03-13 00:57:33 +00:00
Misc
…
Notice
…
Number Bug 18736: (follow-up) Fix missing rounding and bad formatting 2019-03-21 16:29:06 +00:00
OAI/Server Bug 24809: (QA follow-up) Add prefix to prevent disambiguity 2020-03-31 22:08:53 +00:00
Object Bug 15774: Remove unecessary returned value for ->delete 2019-03-07 20:37:06 +00:00
Objects Bug 23599: Avoid exploding in search_with_library_limits when no library is passed 2019-09-12 16:00:41 +01:00
Old
…
Patron Bug 24840: [19.11.x] Replace DateTime->now with dt_from_string 2020-05-07 17:17:12 +00:00
Patrons Bug 22025: Remove warnings when importing patrons 2020-04-03 21:11:23 +00:00
Plugins Bug 25099: Sending a LANG variable to plug-in template 2020-05-11 22:01:55 +00:00
QueryParser/Driver
…
REST Bug 24909: Add unprivileged route to get a bibliographic record 2020-06-15 10:38:33 +12:00
RecordProcessor
…
SMS
…
Schema Revert "Bug 23727: Update Schema" 2020-05-19 23:47:11 +00:00
SearchEngine Bug 25278: add clear_search_fields_cache method 2020-05-19 22:59:40 +00:00
Serial
…
Sitemapper Bug 24840: [19.11.x] Replace DateTime->now with dt_from_string 2020-05-07 17:17:12 +00:00
Subscription Bug 17047: add a dedicated page for Mana setup 2019-01-23 14:39:26 +00:00
SuggestionEngine Bug 14457: (QA follow-up) Fix POD 2019-04-16 13:17:34 +00:00
Tags Bug 21846: Add Koha::Tags::Approval(s) and Koha::Tags::Index(es) 2019-03-15 12:27:44 +00:00
Template/Plugin Bug 24068: (RM follow-up) Enhance the POD 2019-11-22 14:57:46 +00:00
Util Bug 23324: (QA follow-up) Typo and remove unneeded use statement 2019-08-16 12:27:01 +01:00
XSLT Bug 23290: [RMaint version] Mitigate XML/XSLT vulnerabilities 2020-02-20 23:37:20 +00:00
Z3950Responder Bug 25277: Don't specify a field in query if none passed 2020-05-19 22:57:25 +00:00
pdfformat Bug 5016: Fix some translation issues with English PDF order templates 2020-03-13 00:09:37 +00:00
Account.pm Bug 24542: (bug 23049 follow-up) Add missing use statement in Koha::Account 2020-02-10 23:17:17 +00:00
ActionLog.pm Bug 22363: (follow-up) Fix pod 2019-03-11 11:22:01 +00:00
ActionLogs.pm Bug 22363: (follow-up) Fix pod 2019-03-11 11:22:01 +00:00
AdditionalField.pm Bug 15774: Add POD and license notices 2019-03-07 20:37:05 +00:00
AdditionalFieldValue.pm Bug 22934: Add missing use statement 2019-05-23 14:43:16 +00:00
AdditionalFieldValues.pm Bug 15774: (follow-up) Address QA issues 2019-03-07 20:37:05 +00:00
AdditionalFields.pm Bug 15774: Add POD and license notices 2019-03-07 20:37:05 +00:00
ApiKey.pm
…
ApiKeys.pm
…
ArticleRequest.pm Bug 23384: Fix use statement order for ArticleRequest::Status 2020-04-02 16:22:10 +00:00
ArticleRequests.pm Bug 23384: Fix use statement order for ArticleRequest::Status 2020-04-02 16:22:10 +00:00
AudioAlert.pm
…
AudioAlerts.pm
…
AuthUtils.pm Bug 20370: Misleading comment for bcrypt - #encrypt it; Instead it should be #hash it 2020-05-05 20:41:34 +00:00
AuthorisedValue.pm Bug 23272: Make Koha::AuthorisedValue use Koha::Object::Limit::Library 2019-09-13 08:04:05 +01:00
AuthorisedValueCategories.pm
…
AuthorisedValueCategory.pm
…
AuthorisedValues.pm
…
Authorities.pm
…
Authority.pm
…
Biblio.pm Bug 23310: Reduce noise in Koha::Biblio 2019-10-28 12:38:39 +00:00
BiblioFramework.pm
…
BiblioFrameworks.pm
…
BiblioUtils.pm Bug 21872: Remove duplicate modulo condition in authorities iterator 2019-05-10 12:31:49 +00:00
Biblioitem.pm
…
Biblioitems.pm
…
Biblios.pm
…
Cache.pm Bug 13193: Make Memcached usage fork safe 2020-03-05 23:49:57 +00:00
Caches.pm
…
Calendar.pm Bug 24840: [19.11.x] Replace DateTime->now with dt_from_string 2020-05-07 17:17:12 +00:00
Checkout.pm Bug 24840: [19.11.x] Replace DateTime->now with dt_from_string 2020-05-07 17:17:12 +00:00
Checkouts.pm Bug 24840: [19.11.x] Replace DateTime->now with dt_from_string 2020-05-07 17:17:12 +00:00
CirculationRule.pm
…
CirculationRules.pm Bug 22679: Delete related CirculationRules when Removing IssuingRule 2019-04-24 10:35:38 +00:00
Cities.pm
…
City.pm Bug 23770: Add to_api_mapping method to Koha::City 2019-10-21 10:03:53 +01:00
ClassSortRule.pm
…
ClassSortRules.pm
…
ClassSource.pm
…
ClassSources.pm
…
ClassSplitRule.pm
…
ClassSplitRules.pm
…
Club.pm Bug 19809: Re-allow to call Koha::Objects::find in list context 2020-02-11 19:27:34 +00:00
Clubs.pm
…
Config.pm
…
CsvProfile.pm
…
CsvProfiles.pm
…
Database.pm Bug 23022: Remove the SQl mode NO_AUTO_CREATE_USER 2019-06-15 07:52:09 +01:00
DateUtils.pm Bug 25617: (bug 25133 follow-up) 12 PM is not 24 but 0 2020-06-12 04:01:58 +00:00
EDI.pm Bug 24840: [19.11.x] Replace DateTime->now with dt_from_string 2020-05-07 17:17:12 +00:00
Edifact.pm
…
Email.pm Bug 24826: Remove warnings from Sendmail 2020-05-01 17:40:24 +00:00
Exceptions.pm
…
ExternalContent.pm
…
FrameworkPlugin.pm Bug 22721: Remove frameworkcode parameter in GetMarcFromKohaField calls 2019-07-15 11:28:08 +01:00
Hold.pm Bug 25535: Hold API mapping maps cancellationdate to cancelation_date, but it should be cancellation_date 2020-05-20 21:27:17 +00:00
Holds.pm
…
I18N.pm Bug 25517: Look in all possible places for MO files 2020-06-12 01:23:06 +00:00
Illcomment.pm
…
Illcomments.pm
…
Illrequest.pm Bug 24840: [19.11.x] Replace DateTime->now with dt_from_string 2020-05-07 17:17:12 +00:00
Illrequestattribute.pm
…
Illrequestattributes.pm
…
Illrequests.pm
…
IssuingRule.pm Bug 18928: (bug 22679 follow-up) Do not remove all rules along with the issuing rule 2019-07-01 14:58:13 +01:00
IssuingRules.pm
…
Item.pm Bug 25006: Make Koha::Item->as_marc_field skip undefined subfields 2020-04-28 20:29:28 +00:00
ItemType.pm Bug 15497: Limit itemtypes by branch in additem.pl 2019-09-12 16:31:06 +01:00
ItemTypes.pm Bug 15497: (QA follow-up) Fix call in search_with_localization 2019-09-12 16:31:06 +01:00
Items.pm
…
KeyboardShortcut.pm Bug 21411: Advanced cataloging editor - rancor - Allow configuration of Keyboard 2019-05-10 18:59:39 +00:00
KeyboardShortcuts.pm Bug 21411: Address QA concerns 2019-05-10 18:59:39 +00:00
Libraries.pm Bug 7614: (QA follow-up) Remove unused variable 2019-01-25 16:07:07 +00:00
Library.pm Bug 23843: Add mapping to Koha::Library 2019-10-23 18:03:11 +01:00
Linktracker.pm
…
Localization.pm
…
Localizations.pm
…
Logger.pm Bug 13937: Add a Z39.50 daemon that can inject item status MARC subfields 2019-10-08 14:39:30 +01:00
Manual.pm Bug 24848: Improve manual links for the label creator 2020-04-03 21:12:54 +00:00
MarcSubfieldStructure.pm
…
MarcSubfieldStructures.pm
…
MetaSearcher.pm Bug 24173: Advanced Editor: Show subtitle & published date on the search page 2020-01-14 00:49:15 +00:00
MetadataIterator.pm
…
MetadataRecord.pm
…
MoreUtils.pm
…
News.pm
…
NewsItem.pm
…
OAuth.pm
…
OAuthAccessToken.pm
…
OAuthAccessTokens.pm
…
Object.pm Bug 24788: Remove autoloaded column accessors in Koha::Object->store 2020-04-02 16:18:17 +00:00
Objects.pm Bug 19809: Re-allow to call Koha::Objects::find in list context 2020-02-11 19:27:34 +00:00
Patron.pm Bug 23384: Fix use statement order for ArticleRequest::Status 2020-04-02 16:22:10 +00:00
Patrons.pm Bug 24114: (follow-up) Resolve warning on non-numeric subtraction 2020-03-30 21:57:35 +00:00
Plugins.pm Bug 21073: (QA follow-up) Simplify logic 2019-06-18 17:30:31 +01:00
RDF.pm
…
Rating.pm
…
Ratings.pm
…
RecordProcessor.pm Bug 25008: Overload Koha::RecordProcessor->options to update filters 2020-05-05 20:39:04 +00:00
RefundLostItemFeeRules.pm Bug 18930: (RM follow-up) Restore primary key find 2019-07-16 13:53:54 +01:00
Report.pm Bug 17047: SQL reports management with Mana-KB 2019-01-23 14:39:26 +00:00
Reports.pm Bug 17047: SQL reports management with Mana-KB 2019-01-23 14:39:26 +00:00
Review.pm
…
Reviews.pm
…
Schema.pm
…
Script.pm Bug 22600: Set 'commandline' interface appropriately 2019-04-10 19:43:11 +00:00
SearchEngine.pm
…
SearchField.pm Bug 20589: Add field boosting and use query_string fields parameter 2019-10-02 13:28:57 +01:00
SearchFields.pm Bug 20589: Add field boosting and use query_string fields parameter 2019-10-02 13:28:57 +01:00
SearchMarcMap.pm
…
SearchMarcMaps.pm
…
Serial.pm
…
Serials.pm
…
SharedContent.pm Bug 23075: (follow-up) Dissallow transparent redirects 2019-11-06 17:05:10 +00:00
SimpleMARC.pm Bug 22571: Handle control fields in MMT for conditionals 2019-06-21 13:12:46 +01:00
Sitemapper.pm
…
StockRotationItem.pm Bug 24840: [19.11.x] Replace DateTime->now with dt_from_string 2020-05-07 17:17:12 +00:00
StockRotationItems.pm
…
StockRotationRota.pm
…
StockRotationRotas.pm Bug 22566: Fix some more issues 2019-06-25 17:01:11 +01:00
StockRotationStage.pm
…
StockRotationStages.pm
…
Subscription.pm Bug 19809: Re-allow to call Koha::Objects::find in list context 2020-02-11 19:27:34 +00:00
Subscriptions.pm Bug 15774: Use Koha::Object(s) for additional fields 2019-03-07 20:37:05 +00:00
Suggestion.pm
…
SuggestionEngine.pm
…
Suggestions.pm
…
Tag.pm Bug 21846: Add Koha::Tags::Approval(s) and Koha::Tags::Index(es) 2019-03-15 12:27:44 +00:00
Tags.pm Bug 21846: Add Koha::Tags::Approval(s) and Koha::Tags::Index(es) 2019-03-15 12:27:44 +00:00
Token.pm Bug 21998: Throw exception on bad pattern 2019-03-22 20:21:44 +00:00
UploadedFile.pm
…
UploadedFiles.pm
…
Uploader.pm
…
Virtualshelf.pm
…
Virtualshelfcontent.pm
…
Virtualshelfcontents.pm
…
Virtualshelfshare.pm
…
Virtualshelfshares.pm
…
Virtualshelves.pm
…
XSLT_Handler.pm Bug 23290: [RMaint version] Mitigate XML/XSLT vulnerabilities 2020-02-20 23:37:20 +00:00
Z3950Responder.pm Bug 13937: (RM follow-up) Set working directory for daemon mode. 2019-10-15 13:48:28 +01:00
Z3950Server.pm
…
Z3950Servers.pm
…