The unsupported "lending policy" feature is removed and reimplemented by expanding a feature that is supported -- patron root lanes.
I added a cache for the result of Library.has_root_lanes, a somewhat complicated database query that is now going to be called on almost every incoming circulation manager request.
I added new methods Work.age_appropriate_for_patron and Patron.work_is_age_appropriate. These methods (more precisely, the helper method Patron.age_appropriate_match) implement a reasonable interpretation of what it means for a work (which has an audience and a target age) to be "age-appropriate" for a patron (whose root lane may have multiple audiences as well as a target age). I needed both methods because when we're calculating Worklist visibility (below) we need to answer a general age-appropriateness question, without having any specific Work in mind.
I added a new method, WorkList.accessible_to and Lane.accessible_to, which control whether a WorkList is accessible to a given patron. Basically, WorkLists are accessible to a patron unless they might contain age-inappropriate material. (This lets us give Open eBooks access to related-books lanes such as "books by the same author" lanes) Lanes are subject to the same rules, but they must also be in scope from the patron's root lane.
This is a core support branch for https://jira.nypl.org/browse/SIMPLY-3125.
Library.has_root_lanes
, a somewhat complicated database query that is now going to be called on almost every incoming circulation manager request.Work.age_appropriate_for_patron
andPatron.work_is_age_appropriate
. These methods (more precisely, the helper methodPatron.age_appropriate_match
) implement a reasonable interpretation of what it means for a work (which has an audience and a target age) to be "age-appropriate" for a patron (whose root lane may have multiple audiences as well as a target age). I needed both methods because when we're calculating Worklist visibility (below) we need to answer a general age-appropriateness question, without having any specific Work in mind.WorkList.accessible_to
andLane.accessible_to
, which control whether a WorkList is accessible to a given patron. Basically, WorkLists are accessible to a patron unless they might contain age-inappropriate material. (This lets us give Open eBooks access to related-books lanes such as "books by the same author" lanes) Lanes are subject to the same rules, but they must also be in scope from the patron's root lane.