invenio-app-ils 1.0.0a54__py2.py3-none-any.whl → 6.1.0__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (331) hide show
  1. invenio_app_ils/__init__.py +2 -2
  2. invenio_app_ils/acquisition/api.py +3 -1
  3. invenio_app_ils/acquisition/config.py +10 -21
  4. invenio_app_ils/acquisition/jsonresolvers/order_order_lines.py +1 -0
  5. invenio_app_ils/acquisition/mappings/os-v1/acq_orders/order-v1.0.0.json +364 -0
  6. invenio_app_ils/acquisition/mappings/os-v2/__init__.py +0 -0
  7. invenio_app_ils/acquisition/mappings/os-v2/acq_orders/order-v1.0.0.json +364 -0
  8. invenio_app_ils/acquisition/mappings/v7/acq_orders/order-v1.0.0.json +14 -0
  9. invenio_app_ils/acquisition/search.py +5 -15
  10. invenio_app_ils/assets/semantic-ui/less/theme.config +103 -0
  11. invenio_app_ils/assets/semantic-ui/templates/.gitkeep +0 -0
  12. invenio_app_ils/circulation/api.py +153 -67
  13. invenio_app_ils/circulation/config.py +29 -25
  14. invenio_app_ils/circulation/indexer.py +14 -19
  15. invenio_app_ils/circulation/loaders/__init__.py +2 -0
  16. invenio_app_ils/circulation/loaders/schemas/json/loan_checkout.py +2 -3
  17. invenio_app_ils/circulation/loaders/schemas/json/loan_request.py +82 -16
  18. invenio_app_ils/circulation/loaders/schemas/json/loan_self_checkout.py +19 -0
  19. invenio_app_ils/circulation/notifications/api.py +23 -19
  20. invenio_app_ils/circulation/notifications/messages.py +6 -6
  21. invenio_app_ils/circulation/notifications/tasks.py +1 -2
  22. invenio_app_ils/circulation/receivers.py +2 -5
  23. invenio_app_ils/circulation/search.py +23 -22
  24. invenio_app_ils/circulation/serializers/__init__.py +2 -2
  25. invenio_app_ils/circulation/serializers/csv.py +1 -3
  26. invenio_app_ils/circulation/serializers/custom_fields.py +5 -9
  27. invenio_app_ils/circulation/serializers/json.py +2 -6
  28. invenio_app_ils/circulation/serializers/response.py +12 -12
  29. invenio_app_ils/circulation/stats/views.py +5 -15
  30. invenio_app_ils/circulation/tasks.py +2 -6
  31. invenio_app_ils/circulation/templates/invenio_app_ils_circulation/notifications/self_checkout.html +19 -0
  32. invenio_app_ils/circulation/templates/invenio_app_ils_circulation/notifications/update_dates.html +19 -0
  33. invenio_app_ils/circulation/utils.py +23 -17
  34. invenio_app_ils/circulation/views.py +103 -39
  35. invenio_app_ils/cli.py +220 -260
  36. invenio_app_ils/closures/api.py +72 -7
  37. invenio_app_ils/closures/serializers/__init__.py +16 -0
  38. invenio_app_ils/closures/serializers/response.py +35 -0
  39. invenio_app_ils/closures/serializers/schema.py +28 -0
  40. invenio_app_ils/closures/tasks.py +4 -11
  41. invenio_app_ils/closures/views.py +66 -0
  42. invenio_app_ils/config.py +207 -150
  43. invenio_app_ils/document_requests/api.py +6 -21
  44. invenio_app_ils/document_requests/loaders/__init__.py +4 -12
  45. invenio_app_ils/document_requests/mappings/{v6 → os-v1}/__init__.py +2 -2
  46. invenio_app_ils/document_requests/mappings/os-v1/document_requests/document_request-v1.0.0.json +196 -0
  47. invenio_app_ils/document_requests/mappings/os-v2/__init__.py +8 -0
  48. invenio_app_ils/document_requests/mappings/os-v2/document_requests/document_request-v1.0.0.json +196 -0
  49. invenio_app_ils/document_requests/notifications/api.py +2 -7
  50. invenio_app_ils/document_requests/notifications/messages.py +3 -7
  51. invenio_app_ils/document_requests/search.py +2 -6
  52. invenio_app_ils/document_requests/views.py +4 -10
  53. invenio_app_ils/documents/api.py +19 -25
  54. invenio_app_ils/documents/indexer.py +13 -20
  55. invenio_app_ils/documents/jsonresolvers/document_circulation.py +11 -33
  56. invenio_app_ils/documents/jsonresolvers/document_eitem.py +1 -0
  57. invenio_app_ils/documents/jsonresolvers/document_item.py +8 -9
  58. invenio_app_ils/documents/jsonresolvers/document_stock.py +7 -7
  59. invenio_app_ils/documents/loaders/jsonschemas/document.py +3 -14
  60. invenio_app_ils/documents/mappings/{v6 → os-v1}/__init__.py +1 -1
  61. invenio_app_ils/documents/mappings/os-v1/documents/document-v1.0.0.json +932 -0
  62. invenio_app_ils/documents/mappings/os-v1/documents/document-v2.0.0.json +1066 -0
  63. invenio_app_ils/documents/mappings/os-v2/__init__.py +8 -0
  64. invenio_app_ils/documents/mappings/os-v2/documents/document-v1.0.0.json +932 -0
  65. invenio_app_ils/documents/mappings/os-v2/documents/document-v2.0.0.json +1066 -0
  66. invenio_app_ils/documents/mappings/v7/documents/document-v1.0.0.json +102 -11
  67. invenio_app_ils/documents/mappings/v7/documents/document-v2.0.0.json +1066 -0
  68. invenio_app_ils/documents/schemas/documents/document-v2.0.0.json +732 -0
  69. invenio_app_ils/eitems/api.py +41 -7
  70. invenio_app_ils/eitems/loaders/jsonschemas/eitems.py +6 -6
  71. invenio_app_ils/eitems/mappings/{v6 → os-v1}/__init__.py +1 -1
  72. invenio_app_ils/eitems/mappings/os-v1/eitems/eitem-v1.0.0.json +139 -0
  73. invenio_app_ils/eitems/mappings/os-v1/eitems/eitem-v2.0.0.json +142 -0
  74. invenio_app_ils/eitems/mappings/os-v1/eitems/eitem-v3.0.0.json +179 -0
  75. invenio_app_ils/{series/mappings/v6 → eitems/mappings/os-v2}/__init__.py +1 -1
  76. invenio_app_ils/eitems/mappings/os-v2/eitems/eitem-v1.0.0.json +139 -0
  77. invenio_app_ils/eitems/mappings/os-v2/eitems/eitem-v2.0.0.json +142 -0
  78. invenio_app_ils/eitems/mappings/os-v2/eitems/eitem-v3.0.0.json +179 -0
  79. invenio_app_ils/eitems/mappings/v7/eitems/eitem-v1.0.0.json +12 -2
  80. invenio_app_ils/eitems/mappings/v7/eitems/eitem-v2.0.0.json +142 -0
  81. invenio_app_ils/eitems/mappings/v7/eitems/eitem-v3.0.0.json +179 -0
  82. invenio_app_ils/eitems/schemas/eitems/eitem-v2.0.0.json +120 -0
  83. invenio_app_ils/eitems/schemas/eitems/eitem-v3.0.0.json +120 -0
  84. invenio_app_ils/eitems/search.py +3 -9
  85. invenio_app_ils/errors.py +119 -6
  86. invenio_app_ils/ext.py +15 -18
  87. invenio_app_ils/facets.py +13 -15
  88. invenio_app_ils/files/receivers.py +1 -1
  89. invenio_app_ils/files/views.py +1 -2
  90. invenio_app_ils/ill/api.py +1 -2
  91. invenio_app_ils/ill/config.py +10 -16
  92. invenio_app_ils/ill/jsonresolvers/borrowing_request_document.py +2 -3
  93. invenio_app_ils/ill/jsonresolvers/borrowing_request_patron.py +1 -3
  94. invenio_app_ils/ill/jsonresolvers/borrowing_request_provider.py +1 -3
  95. invenio_app_ils/ill/loaders/__init__.py +3 -9
  96. invenio_app_ils/ill/loaders/jsonschemas/patron_loan_actions.py +1 -8
  97. invenio_app_ils/ill/loaders/jsonschemas/patron_loan_extension_actions.py +3 -8
  98. invenio_app_ils/ill/mappings/{v6 → os-v1}/__init__.py +1 -1
  99. invenio_app_ils/ill/mappings/os-v1/ill_borrowing_requests/borrowing_request-v1.0.0.json +254 -0
  100. invenio_app_ils/{acquisition/mappings/v6 → ill/mappings/os-v2}/__init__.py +1 -1
  101. invenio_app_ils/ill/mappings/os-v2/ill_borrowing_requests/borrowing_request-v1.0.0.json +254 -0
  102. invenio_app_ils/ill/mappings/v7/ill_borrowing_requests/borrowing_request-v1.0.0.json +14 -0
  103. invenio_app_ils/ill/notifications/api.py +1 -4
  104. invenio_app_ils/ill/search.py +3 -9
  105. invenio_app_ils/ill/serializers/__init__.py +1 -3
  106. invenio_app_ils/ill/views.py +2 -4
  107. invenio_app_ils/internal_locations/api.py +1 -4
  108. invenio_app_ils/internal_locations/mappings/{v6 → os-v1}/__init__.py +1 -1
  109. invenio_app_ils/internal_locations/mappings/os-v1/internal_locations/internal_location-v1.0.0.json +108 -0
  110. invenio_app_ils/internal_locations/mappings/os-v2/__init__.py +8 -0
  111. invenio_app_ils/internal_locations/mappings/os-v2/internal_locations/internal_location-v1.0.0.json +108 -0
  112. invenio_app_ils/internal_locations/search.py +1 -3
  113. invenio_app_ils/items/api.py +18 -15
  114. invenio_app_ils/items/indexer.py +1 -3
  115. invenio_app_ils/items/jsonresolvers/item_document.py +1 -1
  116. invenio_app_ils/items/jsonresolvers/item_internal_location.py +2 -6
  117. invenio_app_ils/items/loaders/jsonschemas/items.py +2 -0
  118. {tests/api/circulation → invenio_app_ils/items/mappings/os-v1}/__init__.py +1 -1
  119. invenio_app_ils/items/mappings/os-v1/items/item-v1.0.0.json +285 -0
  120. invenio_app_ils/items/mappings/os-v1/items/item-v2.0.0.json +326 -0
  121. {tests/api/ill → invenio_app_ils/items/mappings/os-v2}/__init__.py +1 -1
  122. invenio_app_ils/items/mappings/os-v2/items/item-v1.0.0.json +285 -0
  123. invenio_app_ils/items/mappings/os-v2/items/item-v2.0.0.json +326 -0
  124. invenio_app_ils/items/mappings/v7/items/item-v1.0.0.json +11 -0
  125. invenio_app_ils/items/mappings/v7/items/item-v2.0.0.json +326 -0
  126. invenio_app_ils/items/schemas/items/item-v1.0.0.json +22 -0
  127. invenio_app_ils/items/schemas/items/item-v2.0.0.json +172 -0
  128. invenio_app_ils/items/search.py +18 -11
  129. invenio_app_ils/items/serializers/item.py +7 -6
  130. invenio_app_ils/literature/api.py +1 -3
  131. invenio_app_ils/literature/search.py +3 -5
  132. invenio_app_ils/literature/serializers/csv.py +1 -3
  133. invenio_app_ils/literature/serializers/json.py +1 -3
  134. invenio_app_ils/locations/api.py +2 -4
  135. invenio_app_ils/locations/indexer.py +3 -9
  136. invenio_app_ils/locations/loaders/__init__.py +1 -3
  137. invenio_app_ils/locations/loaders/jsonschemas/location.py +4 -11
  138. invenio_app_ils/locations/mappings/{v6 → os-v1}/__init__.py +1 -1
  139. invenio_app_ils/locations/mappings/os-v1/locations/location-v1.0.0.json +90 -0
  140. invenio_app_ils/locations/mappings/os-v2/__init__.py +8 -0
  141. invenio_app_ils/locations/mappings/os-v2/locations/location-v1.0.0.json +90 -0
  142. invenio_app_ils/notifications/messages.py +4 -3
  143. invenio_app_ils/notifications/tasks.py +1 -3
  144. invenio_app_ils/notifications/views.py +2 -2
  145. invenio_app_ils/patrons/anonymization.py +53 -32
  146. invenio_app_ils/patrons/api.py +3 -5
  147. invenio_app_ils/patrons/cli.py +1 -2
  148. invenio_app_ils/patrons/indexer.py +4 -13
  149. invenio_app_ils/patrons/mappings/os-v1/__init__.py +8 -0
  150. invenio_app_ils/patrons/mappings/os-v1/patrons/patron-v1.0.0.json +42 -0
  151. invenio_app_ils/patrons/mappings/os-v2/__init__.py +8 -0
  152. invenio_app_ils/patrons/mappings/os-v2/patrons/patron-v1.0.0.json +42 -0
  153. invenio_app_ils/patrons/views.py +4 -14
  154. invenio_app_ils/permissions.py +93 -35
  155. invenio_app_ils/providers/api.py +2 -6
  156. invenio_app_ils/providers/config.py +11 -19
  157. invenio_app_ils/providers/indexer.py +2 -6
  158. invenio_app_ils/providers/mappings/{v6 → os-v1}/__init__.py +1 -1
  159. invenio_app_ils/providers/mappings/os-v1/providers/provider-v1.0.0.json +57 -0
  160. invenio_app_ils/providers/mappings/os-v2/__init__.py +8 -0
  161. invenio_app_ils/providers/mappings/os-v2/providers/provider-v1.0.0.json +57 -0
  162. invenio_app_ils/providers/mappings/v7/__init__.py +1 -1
  163. invenio_app_ils/providers/proxies.py +1 -3
  164. invenio_app_ils/records/api.py +3 -9
  165. invenio_app_ils/records/loaders/schemas/changed_by.py +1 -3
  166. invenio_app_ils/records/loaders/schemas/identifiers.py +23 -0
  167. invenio_app_ils/records/metadata_extensions.py +1 -4
  168. invenio_app_ils/records/permissions.py +8 -2
  169. invenio_app_ils/records/serializers/__init__.py +1 -4
  170. invenio_app_ils/records/views.py +4 -7
  171. invenio_app_ils/records_relations/api.py +11 -34
  172. invenio_app_ils/records_relations/indexer.py +1 -3
  173. invenio_app_ils/records_relations/retriever.py +14 -9
  174. invenio_app_ils/records_relations/views.py +16 -50
  175. invenio_app_ils/relations/api.py +17 -16
  176. invenio_app_ils/search_permissions.py +24 -24
  177. invenio_app_ils/series/api.py +10 -12
  178. invenio_app_ils/series/loaders/jsonschemas/series.py +3 -2
  179. invenio_app_ils/{items/mappings/v6 → series/mappings/os-v1}/__init__.py +1 -1
  180. invenio_app_ils/series/mappings/os-v1/series/series-v1.0.0.json +324 -0
  181. invenio_app_ils/series/mappings/os-v1/series/series-v2.0.0.json +396 -0
  182. {tests/api/acquisition → invenio_app_ils/series/mappings/os-v2}/__init__.py +1 -1
  183. invenio_app_ils/series/mappings/os-v2/series/series-v1.0.0.json +324 -0
  184. invenio_app_ils/series/mappings/os-v2/series/series-v2.0.0.json +396 -0
  185. invenio_app_ils/series/mappings/v7/series/series-v1.0.0.json +35 -3
  186. invenio_app_ils/series/mappings/v7/series/series-v2.0.0.json +396 -0
  187. invenio_app_ils/series/schemas/series/series-v2.0.0.json +354 -0
  188. invenio_app_ils/stats/aggregations/aggr_file_download/os-v1/aggr-file-download-v1.json +60 -0
  189. invenio_app_ils/stats/aggregations/aggr_file_download/os-v2/__init__.py +9 -0
  190. invenio_app_ils/stats/aggregations/aggr_file_download/os-v2/aggr-file-download-v1.json +60 -0
  191. invenio_app_ils/stats/event_builders.py +73 -0
  192. invenio_app_ils/stats/file_download/os-v1/file-download-v1.json +72 -0
  193. invenio_app_ils/stats/file_download/os-v2/__init__.py +9 -0
  194. invenio_app_ils/stats/file_download/os-v2/file-download-v1.json +72 -0
  195. invenio_app_ils/stats/processors.py +30 -0
  196. invenio_app_ils/stats/templates/aggregations/__init__.py +8 -0
  197. invenio_app_ils/stats/templates/aggregations/ils_record_changes/__init__.py +8 -0
  198. invenio_app_ils/stats/templates/aggregations/ils_record_changes/os-v2/__init__.py +8 -0
  199. invenio_app_ils/stats/templates/aggregations/ils_record_changes/os-v2/aggr-ils-record-changes-v1.json +41 -0
  200. {tests → invenio_app_ils/stats/templates/events}/__init__.py +2 -2
  201. invenio_app_ils/stats/templates/events/ils_record_changes/__init__.py +8 -0
  202. invenio_app_ils/stats/templates/events/ils_record_changes/os-v2/__init__.py +8 -0
  203. invenio_app_ils/stats/templates/events/ils_record_changes/os-v2/ils-record-changes-v1.json +41 -0
  204. invenio_app_ils/templates/logged_out.html +12 -0
  205. invenio_app_ils/views.py +18 -4
  206. invenio_app_ils/vocabularies/api.py +1 -1
  207. invenio_app_ils/vocabularies/cli.py +6 -18
  208. invenio_app_ils/vocabularies/data/acq_order_line_payment_modes.json +5 -0
  209. invenio_app_ils/vocabularies/data/identifier_schemes.json +5 -0
  210. invenio_app_ils/vocabularies/indexer.py +1 -4
  211. invenio_app_ils/vocabularies/jsonresolvers/licenses.py +2 -11
  212. invenio_app_ils/vocabularies/mappings/os-v1/__init__.py +8 -0
  213. invenio_app_ils/vocabularies/mappings/os-v1/vocabularies/vocabulary-v1.0.0.json +23 -0
  214. invenio_app_ils/vocabularies/mappings/os-v2/__init__.py +8 -0
  215. invenio_app_ils/vocabularies/mappings/os-v2/vocabularies/vocabulary-v1.0.0.json +23 -0
  216. invenio_app_ils/vocabularies/sources/base.py +1 -3
  217. invenio_app_ils/webpack.py +27 -0
  218. invenio_app_ils-6.1.0.dist-info/METADATA +627 -0
  219. {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info}/RECORD +227 -249
  220. {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info}/WHEEL +1 -1
  221. {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info}/entry_points.txt +9 -5
  222. {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info}/top_level.txt +0 -1
  223. invenio_app_ils/acquisition/mappings/v6/acq_orders/order-v1.0.0.json +0 -352
  224. invenio_app_ils/document_requests/mappings/v6/document_requests/document_request-v1.0.0.json +0 -199
  225. invenio_app_ils/documents/mappings/v6/documents/document-v1.0.0.json +0 -843
  226. invenio_app_ils/eitems/mappings/v6/eitems/eitem-v1.0.0.json +0 -131
  227. invenio_app_ils/ill/mappings/v6/ill_borrowing_requests/borrowing_request-v1.0.0.json +0 -242
  228. invenio_app_ils/internal_locations/mappings/v6/internal_locations/internal_location-v1.0.0.json +0 -110
  229. invenio_app_ils/items/mappings/v6/items/item-v1.0.0.json +0 -276
  230. invenio_app_ils/locations/mappings/v6/locations/location-v1.0.0.json +0 -92
  231. invenio_app_ils/notifications/admin.py +0 -57
  232. invenio_app_ils/patrons/mappings/v6/__init__.py +0 -8
  233. invenio_app_ils/patrons/mappings/v6/patrons/patron-v1.0.0.json +0 -44
  234. invenio_app_ils/providers/mappings/v6/providers/provider-v1.0.0.json +0 -59
  235. invenio_app_ils/series/mappings/v6/series/series-v1.0.0.json +0 -298
  236. invenio_app_ils/stats/aggregations/aggr_file_download/v6/aggr-file-download-v1.json +0 -59
  237. invenio_app_ils/stats/file_download/v6/file-download-v1.json +0 -74
  238. invenio_app_ils/version.py +0 -14
  239. invenio_app_ils/vocabularies/mappings/v6/__init__.py +0 -8
  240. invenio_app_ils/vocabularies/mappings/v6/vocabularies/vocabulary-v1.0.0.json +0 -25
  241. invenio_app_ils-1.0.0a54.dist-info/METADATA +0 -95
  242. tests/api/__init__.py +0 -8
  243. tests/api/acquisition/test_acq_orders_crud.py +0 -102
  244. tests/api/acquisition/test_acq_orders_permissions.py +0 -104
  245. tests/api/acquisition/test_acq_providers_permissions.py +0 -83
  246. tests/api/circulation/test_expired_loans.py +0 -88
  247. tests/api/circulation/test_loan_checkout.py +0 -216
  248. tests/api/circulation/test_loan_default_durations.py +0 -57
  249. tests/api/circulation/test_loan_document_resolver.py +0 -18
  250. tests/api/circulation/test_loan_extend.py +0 -132
  251. tests/api/circulation/test_loan_item_permissions.py +0 -139
  252. tests/api/circulation/test_loan_item_resolver.py +0 -26
  253. tests/api/circulation/test_loan_list_permissions.py +0 -104
  254. tests/api/circulation/test_loan_patron_resolver.py +0 -38
  255. tests/api/circulation/test_loan_request.py +0 -234
  256. tests/api/circulation/test_loan_update.py +0 -150
  257. tests/api/circulation/test_notifications.py +0 -229
  258. tests/api/conftest.py +0 -236
  259. tests/api/document_requests/__init__.py +0 -8
  260. tests/api/document_requests/test_document_requests.py +0 -131
  261. tests/api/document_requests/test_document_requests_permissions.py +0 -177
  262. tests/api/document_requests/test_notifications_filter.py +0 -36
  263. tests/api/ill/test_ill_brw_crud.py +0 -84
  264. tests/api/ill/test_ill_brw_reqs_patron_loan_create_action.py +0 -207
  265. tests/api/ill/test_ill_brw_reqs_patron_loan_extension_actions.py +0 -298
  266. tests/api/ill/test_ill_brw_reqs_permissions.py +0 -169
  267. tests/api/ill/test_ill_providers_permissions.py +0 -82
  268. tests/api/ils/__init__.py +0 -8
  269. tests/api/ils/documents/__init__.py +0 -8
  270. tests/api/ils/documents/test_document_crud.py +0 -57
  271. tests/api/ils/documents/test_document_permissions.py +0 -106
  272. tests/api/ils/documents/test_document_resolvers.py +0 -35
  273. tests/api/ils/eitems/__init__.py +0 -8
  274. tests/api/ils/eitems/test_eitems_crud.py +0 -41
  275. tests/api/ils/eitems/test_eitems_permissions.py +0 -84
  276. tests/api/ils/eitems/test_files.py +0 -172
  277. tests/api/ils/items/__init__.py +0 -8
  278. tests/api/ils/items/test_apis.py +0 -43
  279. tests/api/ils/items/test_items_crud.py +0 -60
  280. tests/api/ils/items/test_items_permissions.py +0 -107
  281. tests/api/ils/items/test_items_update.py +0 -47
  282. tests/api/ils/records_relations/__init__.py +0 -8
  283. tests/api/ils/records_relations/helpers.py +0 -115
  284. tests/api/ils/records_relations/test_records_relations_parentchild.py +0 -560
  285. tests/api/ils/records_relations/test_records_relations_sequence.py +0 -302
  286. tests/api/ils/records_relations/test_records_relations_siblings.py +0 -678
  287. tests/api/ils/series/__init__.py +0 -8
  288. tests/api/ils/series/test_series_permissions.py +0 -95
  289. tests/api/ils/test_anonymization.py +0 -189
  290. tests/api/ils/test_apis.py +0 -76
  291. tests/api/ils/test_closures.py +0 -324
  292. tests/api/ils/test_errors.py +0 -126
  293. tests/api/ils/test_facets.py +0 -84
  294. tests/api/ils/test_internal_locations.py +0 -96
  295. tests/api/ils/test_loaders.py +0 -55
  296. tests/api/ils/test_metadata_extensions.py +0 -205
  297. tests/api/ils/test_notifications.py +0 -183
  298. tests/api/ils/test_notifications_mails.py +0 -39
  299. tests/api/ils/test_notifications_permissions.py +0 -55
  300. tests/api/ils/test_patrons.py +0 -106
  301. tests/api/ils/test_record_delete.py +0 -46
  302. tests/api/ils/test_record_permissions.py +0 -135
  303. tests/api/ils/test_resolvers.py +0 -207
  304. tests/api/ils/test_stats.py +0 -160
  305. tests/api/ils/test_tasks.py +0 -211
  306. tests/api/ils/test_vocabularies.py +0 -35
  307. tests/conftest.py +0 -123
  308. tests/data/acq_orders.json +0 -89
  309. tests/data/acq_providers.json +0 -12
  310. tests/data/document_requests.json +0 -77
  311. tests/data/documents.json +0 -237
  312. tests/data/eitems.json +0 -66
  313. tests/data/ill_borrowing_requests.json +0 -77
  314. tests/data/ill_providers.json +0 -12
  315. tests/data/internal_locations.json +0 -22
  316. tests/data/items.json +0 -271
  317. tests/data/loans.json +0 -133
  318. tests/data/loans_most_loaned.json +0 -128
  319. tests/data/locations.json +0 -20
  320. tests/data/series.json +0 -33
  321. tests/helpers.py +0 -104
  322. tests/templates/notifications/title_body.html +0 -8
  323. tests/templates/notifications/title_body_html.html +0 -13
  324. tests/templates/notifications/title_body_html_ctx.html +0 -13
  325. tests/templates/notifications/title_only.html +0 -3
  326. tests/test_version.py +0 -17
  327. /tests/templates/notifications/blank.html → /invenio_app_ils/acquisition/mappings/os-v1/__init__.py +0 -0
  328. /invenio_app_ils/stats/aggregations/aggr_file_download/{v6 → os-v1}/__init__.py +0 -0
  329. /invenio_app_ils/stats/file_download/{v6 → os-v1}/__init__.py +0 -0
  330. {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info/licenses}/AUTHORS.rst +0 -0
  331. {invenio_app_ils-1.0.0a54.dist-info → invenio_app_ils-6.1.0.dist-info/licenses}/LICENSE +0 -0
@@ -0,0 +1,42 @@
1
+ {
2
+ "settings": {
3
+ "analysis": {
4
+ "analyzer": {
5
+ "email": {
6
+ "type": "custom",
7
+ "tokenizer": "uax_url_email"
8
+ }
9
+ }
10
+ }
11
+ },
12
+ "mappings": {
13
+ "date_detection": false,
14
+ "numeric_detection": false,
15
+ "properties": {
16
+ "$schema": {
17
+ "type": "keyword"
18
+ },
19
+ "email": {
20
+ "type": "text",
21
+ "analyzer": "email"
22
+ },
23
+ "id": {
24
+ "type": "keyword"
25
+ },
26
+ "name": {
27
+ "type": "text",
28
+ "fields": {
29
+ "keyword": {
30
+ "type": "keyword"
31
+ }
32
+ }
33
+ },
34
+ "pid": {
35
+ "type": "keyword"
36
+ },
37
+ "location_pid": {
38
+ "type": "keyword"
39
+ }
40
+ }
41
+ }
42
+ }
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2019 CERN.
4
+ #
5
+ # invenio-app-ils is free software; you can redistribute it and/or modify it
6
+ # under the terms of the MIT License; see LICENSE file for more details.
7
+
8
+ """ILS Patrons ES v7 mappings."""
@@ -0,0 +1,42 @@
1
+ {
2
+ "settings": {
3
+ "analysis": {
4
+ "analyzer": {
5
+ "email": {
6
+ "type": "custom",
7
+ "tokenizer": "uax_url_email"
8
+ }
9
+ }
10
+ }
11
+ },
12
+ "mappings": {
13
+ "date_detection": false,
14
+ "numeric_detection": false,
15
+ "properties": {
16
+ "$schema": {
17
+ "type": "keyword"
18
+ },
19
+ "email": {
20
+ "type": "text",
21
+ "analyzer": "email"
22
+ },
23
+ "id": {
24
+ "type": "keyword"
25
+ },
26
+ "name": {
27
+ "type": "text",
28
+ "fields": {
29
+ "keyword": {
30
+ "type": "keyword"
31
+ }
32
+ }
33
+ },
34
+ "pid": {
35
+ "type": "keyword"
36
+ },
37
+ "location_pid": {
38
+ "type": "keyword"
39
+ }
40
+ }
41
+ }
42
+ }
@@ -7,7 +7,6 @@
7
7
 
8
8
  """Invenio App ILS Patrons views."""
9
9
 
10
- from elasticsearch import VERSION as ES_VERSION
11
10
  from flask import Blueprint, current_app
12
11
  from flask_login import current_user
13
12
  from invenio_circulation.search.api import search_by_patron_item_or_document
@@ -17,8 +16,6 @@ from webargs.flaskparser import use_kwargs
17
16
  from invenio_app_ils.circulation.search import get_loans_aggregated_by_states
18
17
  from invenio_app_ils.permissions import need_permissions
19
18
 
20
- lt_es7 = ES_VERSION[0] < 7
21
-
22
19
 
23
20
  def get_user_loan_information_blueprint(_):
24
21
  """Add patron views to the blueprint."""
@@ -58,20 +55,17 @@ def retrieve_user_loans_information(patron_pid, document_pid):
58
55
  loan_result = loans_search.execute()
59
56
  for bucket in loan_result.aggregations.states.buckets:
60
57
  if (
61
- bucket["key"]
62
- in current_app.config["CIRCULATION_STATES_LOAN_ACTIVE"]
58
+ bucket["key"] in current_app.config["CIRCULATION_STATES_LOAN_ACTIVE"]
63
59
  and bucket["doc_count"] > 0
64
60
  ):
65
61
  user_information["has_active_loan"] = True
66
62
  elif (
67
- bucket["key"]
68
- in current_app.config["CIRCULATION_STATES_LOAN_REQUEST"]
63
+ bucket["key"] in current_app.config["CIRCULATION_STATES_LOAN_REQUEST"]
69
64
  and bucket["doc_count"] > 0
70
65
  ):
71
66
  user_information["is_requested"] = True
72
67
  elif (
73
- bucket["key"]
74
- in current_app.config["CIRCULATION_STATES_LOAN_COMPLETED"]
68
+ bucket["key"] in current_app.config["CIRCULATION_STATES_LOAN_COMPLETED"]
75
69
  and bucket["doc_count"] > 0
76
70
  ):
77
71
  search = search_by_patron_item_or_document(
@@ -82,11 +76,7 @@ def retrieve_user_loans_information(patron_pid, document_pid):
82
76
 
83
77
  search = search.sort({"end_date": {"order": "desc"}})
84
78
  search_result = search.execute()
85
- has_past_loans = (
86
- search_result.hits.total > 0
87
- if lt_es7
88
- else search_result.hits.total.value > 0
89
- )
79
+ has_past_loans = search_result.hits.total.value > 0
90
80
  if has_past_loans:
91
81
  last_loan = search_result.hits[0]
92
82
  user_information["last_loan"] = last_loan["end_date"]
@@ -9,21 +9,18 @@
9
9
 
10
10
  from functools import wraps
11
11
 
12
- from flask import abort, current_app, has_request_context
12
+ from flask import abort, current_app, g, has_request_context
13
13
  from flask_login import current_user
14
14
  from flask_principal import UserNeed
15
15
  from invenio_access import action_factory
16
- from invenio_access.permissions import (
17
- Permission,
18
- authenticated_user,
19
- superuser_access,
20
- )
16
+ from invenio_access.permissions import Permission, authenticated_user, superuser_access
21
17
  from invenio_records_rest.utils import allow_all, deny_all
22
18
 
23
- from invenio_app_ils.errors import InvalidLoanExtendError
19
+ from invenio_app_ils.errors import InvalidLoanExtendError, LoanCheckoutByPatronForbidden
24
20
  from invenio_app_ils.proxies import current_app_ils
25
21
 
26
22
  backoffice_access_action = action_factory("ils-backoffice-access")
23
+ backoffice_readonly_access_action = action_factory("ils-backoffice-readonly-access")
27
24
 
28
25
 
29
26
  def need_permissions(action):
@@ -66,6 +63,11 @@ def backoffice_permission(*args, **kwargs):
66
63
  return Permission(backoffice_access_action)
67
64
 
68
65
 
66
+ def backoffice_read_permission(*args, **kwargs):
67
+ """Return permission for backoffice (full or read-only) read access."""
68
+ return Permission(backoffice_access_action, backoffice_readonly_access_action)
69
+
70
+
69
71
  def superuser_permission(*args, **kwargs):
70
72
  """Return permission to allow only admins."""
71
73
  return Permission(superuser_access)
@@ -107,7 +109,9 @@ def loan_extend_circulation_permission(loan):
107
109
  if current_user.is_anonymous:
108
110
  abort(401)
109
111
 
110
- if current_user.id == int(loan["patron_pid"]):
112
+ is_admin_or_librarian = backoffice_permission().allows(g.identity)
113
+ is_logged_in_patron_owner = current_user.id == int(loan["patron_pid"])
114
+ if not is_admin_or_librarian and is_logged_in_patron_owner:
111
115
  Document = current_app_ils.document_record_cls
112
116
  document_rec = Document.get_record_by_pid(loan["document_pid"])
113
117
  document = document_rec.replace_refs()
@@ -133,43 +137,97 @@ def patron_owner_permission(record):
133
137
  return PatronOwnerPermission(record)
134
138
 
135
139
 
136
- class PatronOwnerPermission(Permission):
137
- """Return Permission to evaluate if the current user owns the record."""
140
+ def loan_checkout_permission(*args, **kwargs):
141
+ """Loan checkout permissions checks.
142
+
143
+ Allow admins and librarians to checkout, patrons to self-checkout when enabled.
144
+ """
145
+ if not has_request_context():
146
+ # CLI or Celery task
147
+ return backoffice_permission()
148
+
149
+ if current_user.is_anonymous:
150
+ abort(401)
151
+
152
+ is_admin_or_librarian = backoffice_permission().allows(g.identity)
153
+ if is_admin_or_librarian:
154
+ return backoffice_permission()
155
+
156
+ # ensure that only the loan's patron can do operations on this loan
157
+ if len(args):
158
+ loan = args[0]
159
+ else:
160
+ loan = kwargs["record"]
161
+ is_patron_current_user = current_user.id == int(loan["patron_pid"])
162
+
163
+ if current_app.config["ILS_SELF_CHECKOUT_ENABLED"] and is_patron_current_user:
164
+ return authenticated_user_permission()
165
+
166
+ raise LoanCheckoutByPatronForbidden(int(loan["patron_pid"]), current_user.id)
167
+
168
+
169
+ class PatronOwnerReadPermission(Permission):
170
+ """Return Permission to evaluate if the current user owns the record or has backoffice read access."""
138
171
 
139
172
  def __init__(self, record):
140
173
  """Constructor."""
141
174
  super().__init__(
142
- UserNeed(int(record["patron_pid"])), backoffice_access_action
175
+ UserNeed(int(record["patron_pid"])),
176
+ backoffice_access_action,
177
+ backoffice_readonly_access_action,
143
178
  )
144
179
 
145
180
 
181
+ class PatronOwnerPermission(Permission):
182
+ """Return Permission to evaluate if the current user owns the record."""
183
+
184
+ def __init__(self, record):
185
+ """Constructor."""
186
+ super().__init__(UserNeed(int(record["patron_pid"])), backoffice_access_action)
187
+
188
+
189
+ _is_authenticated_user = [
190
+ "circulation-loan-request",
191
+ "patron-loans",
192
+ "bulk-loan-extension",
193
+ ]
194
+ _is_backoffice_permission = [
195
+ "circulation-loan-force-checkout",
196
+ "circulation-overdue-loan-notification",
197
+ "circulation-loan-update-dates",
198
+ "relations-create",
199
+ "relations-delete",
200
+ "document-request-actions",
201
+ "bucket-create",
202
+ "ill-brwreq-patron-loan-create",
203
+ "ill-brwreq-patron-loan-extension-accept",
204
+ "ill-brwreq-patron-loan-extension-decline",
205
+ ]
206
+ _is_backoffice_read_permission = [
207
+ "stats-most-loaned",
208
+ "get-notifications-sent-to-patron",
209
+ ]
210
+ _is_patron_owner_permission = [
211
+ "document-request-decline",
212
+ "ill-brwreq-patron-loan-extension-request",
213
+ ]
214
+
215
+
146
216
  def views_permissions_factory(action):
147
217
  """Return ILS views permissions factory."""
148
- is_authenticated_user = ["circulation-loan-request", "patron-loans",
149
- "bulk-loan-extension"]
150
- is_backoffice_permission = [
151
- "circulation-loan-checkout",
152
- "circulation-loan-force-checkout",
153
- "circulation-overdue-loan-notification",
154
- "circulation-loan-update-dates",
155
- "relations-create",
156
- "relations-delete",
157
- "stats-most-loaned",
158
- "document-request-actions",
159
- "bucket-create",
160
- "ill-brwreq-patron-loan-create",
161
- "ill-brwreq-patron-loan-extension-accept",
162
- "ill-brwreq-patron-loan-extension-decline",
163
- "send-notification-to-patron",
164
- ]
165
- is_patron_owner_permission = [
166
- "document-request-decline",
167
- "ill-brwreq-patron-loan-extension-request",
168
- ]
169
- if action in is_authenticated_user:
218
+ if action in _is_authenticated_user:
170
219
  return authenticated_user_permission()
171
- elif action in is_backoffice_permission:
220
+ elif action in _is_backoffice_permission:
172
221
  return backoffice_permission()
173
- elif action in is_patron_owner_permission:
222
+ elif action in _is_backoffice_read_permission:
223
+ return backoffice_read_permission()
224
+ elif action in _is_patron_owner_permission:
174
225
  return PatronOwnerPermission
226
+ elif action == "circulation-loan-checkout":
227
+ return backoffice_permission()
228
+ elif (
229
+ action == "circulation-loan-self-checkout"
230
+ and current_app.config["ILS_SELF_CHECKOUT_ENABLED"]
231
+ ):
232
+ return authenticated_user_permission()
175
233
  return deny_all()
@@ -41,14 +41,10 @@ class Provider(IlsRecord):
41
41
  def delete(self, **kwargs):
42
42
  """Delete record."""
43
43
  order_search_cls = current_ils_acq.order_search_cls
44
- search_order_res = order_search_cls().search_by_provider_pid(
45
- self["pid"]
46
- )
44
+ search_order_res = order_search_cls().search_by_provider_pid(self["pid"])
47
45
 
48
46
  brwreq_search_cls = current_ils_ill.borrowing_request_search_cls
49
- search_brwreq_res = brwreq_search_cls().search_by_provider_pid(
50
- self["pid"]
51
- )
47
+ search_brwreq_res = brwreq_search_cls().search_by_provider_pid(self["pid"])
52
48
 
53
49
  if search_order_res.count() or search_brwreq_res.count():
54
50
  order_ref_ids = [res["pid"] for res in search_order_res.scan()]
@@ -10,14 +10,12 @@
10
10
  from invenio_records_rest.facets import terms_filter
11
11
 
12
12
  from invenio_app_ils.config import RECORDS_REST_MAX_RESULT_WINDOW
13
- from invenio_app_ils.permissions import backoffice_permission
14
-
15
- from .api import (
16
- PROVIDER_PID_FETCHER,
17
- PROVIDER_PID_MINTER,
18
- PROVIDER_PID_TYPE,
19
- Provider,
13
+ from invenio_app_ils.permissions import (
14
+ backoffice_permission,
15
+ backoffice_read_permission,
20
16
  )
17
+
18
+ from .api import PROVIDER_PID_FETCHER, PROVIDER_PID_MINTER, PROVIDER_PID_TYPE, Provider
21
19
  from .indexer import ProviderIndexer
22
20
  from .search import ProviderSearch
23
21
 
@@ -34,20 +32,14 @@ RECORDS_REST_ENDPOINTS = dict(
34
32
  indexer_class=ProviderIndexer,
35
33
  record_class=Provider,
36
34
  record_loaders={
37
- "application/json": (
38
- "invenio_app_ils.providers.loaders:provider_loader"
39
- )
35
+ "application/json": "invenio_app_ils.providers.loaders:provider_loader"
40
36
  },
41
37
  record_serializers={
42
- "application/json": (
43
- "invenio_app_ils.records.serializers:json_v1_response"
44
- )
38
+ "application/json": "invenio_app_ils.records.serializers:json_v1_response"
45
39
  },
46
40
  search_serializers={
47
- "application/json": (
48
- "invenio_app_ils.records.serializers:json_v1_search"
49
- ),
50
- "text/csv": ("invenio_app_ils.records.serializers:csv_v1_search"),
41
+ "application/json": "invenio_app_ils.records.serializers:json_v1_search",
42
+ "text/csv": "invenio_app_ils.records.serializers:csv_v1_search",
51
43
  },
52
44
  search_serializers_aliases={
53
45
  "csv": "text/csv",
@@ -58,8 +50,8 @@ RECORDS_REST_ENDPOINTS = dict(
58
50
  default_media_type="application/json",
59
51
  max_result_window=RECORDS_REST_MAX_RESULT_WINDOW,
60
52
  error_handlers=dict(),
61
- read_permission_factory_imp=backoffice_permission,
62
- list_permission_factory_imp=backoffice_permission,
53
+ read_permission_factory_imp=backoffice_read_permission,
54
+ list_permission_factory_imp=backoffice_read_permission,
63
55
  create_permission_factory_imp=backoffice_permission,
64
56
  update_permission_factory_imp=backoffice_permission,
65
57
  delete_permission_factory_imp=backoffice_permission,
@@ -38,17 +38,13 @@ def provider_index_referenced_records(provider):
38
38
  brwreq_pid_type = BORROWING_REQUEST_PID_TYPE
39
39
 
40
40
  for rec in (
41
- vendor_search_cls()
42
- .search_by_provider_pid(provider_pid=provider["pid"])
43
- .scan()
41
+ vendor_search_cls().search_by_provider_pid(provider_pid=provider["pid"]).scan()
44
42
  ):
45
43
  rec = vendor_record_cls.get_record_by_pid(rec["pid"])
46
44
  referenced.append(dict(pid_type=vendor_pid_type, record=rec))
47
45
 
48
46
  for rec in (
49
- brwreq_search_cls()
50
- .search_by_provider_pid(provider_pid=provider["pid"])
51
- .scan()
47
+ brwreq_search_cls().search_by_provider_pid(provider_pid=provider["pid"]).scan()
52
48
  ):
53
49
  rec = brwreq_record_cls.get_record_by_pid(rec["pid"])
54
50
  referenced.append(dict(pid_type=brwreq_pid_type, record=rec))
@@ -5,4 +5,4 @@
5
5
  # invenio-app-ils is free software; you can redistribute it and/or modify it
6
6
  # under the terms of the MIT License; see LICENSE file for more details.
7
7
 
8
- """Invenio Providers ES v6 mappings."""
8
+ """Invenio Providers OS v1 mappings."""
@@ -0,0 +1,57 @@
1
+ {
2
+ "settings": {
3
+ "analysis": {
4
+ "analyzer": {
5
+ "email": {
6
+ "type": "custom",
7
+ "tokenizer": "uax_url_email"
8
+ }
9
+ }
10
+ }
11
+ },
12
+ "mappings": {
13
+ "date_detection": false,
14
+ "numeric_detection": false,
15
+ "properties": {
16
+ "$schema": {
17
+ "type": "keyword"
18
+ },
19
+ "_created": {
20
+ "type": "date"
21
+ },
22
+ "_updated": {
23
+ "type": "date"
24
+ },
25
+ "address": {
26
+ "type": "text"
27
+ },
28
+ "email": {
29
+ "type": "text",
30
+ "analyzer": "email"
31
+ },
32
+ "legacy_id": {
33
+ "type": "keyword"
34
+ },
35
+ "name": {
36
+ "fields": {
37
+ "keyword": {
38
+ "type": "keyword"
39
+ }
40
+ },
41
+ "type": "text"
42
+ },
43
+ "notes": {
44
+ "type": "text"
45
+ },
46
+ "phone": {
47
+ "type": "keyword"
48
+ },
49
+ "pid": {
50
+ "type": "keyword"
51
+ },
52
+ "type": {
53
+ "type": "keyword"
54
+ }
55
+ }
56
+ }
57
+ }
@@ -0,0 +1,8 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2021 CERN.
4
+ #
5
+ # invenio-app-ils is free software; you can redistribute it and/or modify it
6
+ # under the terms of the MIT License; see LICENSE file for more details.
7
+
8
+ """Invenio Providers OS v2 mappings."""
@@ -0,0 +1,57 @@
1
+ {
2
+ "settings": {
3
+ "analysis": {
4
+ "analyzer": {
5
+ "email": {
6
+ "type": "custom",
7
+ "tokenizer": "uax_url_email"
8
+ }
9
+ }
10
+ }
11
+ },
12
+ "mappings": {
13
+ "date_detection": false,
14
+ "numeric_detection": false,
15
+ "properties": {
16
+ "$schema": {
17
+ "type": "keyword"
18
+ },
19
+ "_created": {
20
+ "type": "date"
21
+ },
22
+ "_updated": {
23
+ "type": "date"
24
+ },
25
+ "address": {
26
+ "type": "text"
27
+ },
28
+ "email": {
29
+ "type": "text",
30
+ "analyzer": "email"
31
+ },
32
+ "legacy_id": {
33
+ "type": "keyword"
34
+ },
35
+ "name": {
36
+ "fields": {
37
+ "keyword": {
38
+ "type": "keyword"
39
+ }
40
+ },
41
+ "type": "text"
42
+ },
43
+ "notes": {
44
+ "type": "text"
45
+ },
46
+ "phone": {
47
+ "type": "keyword"
48
+ },
49
+ "pid": {
50
+ "type": "keyword"
51
+ },
52
+ "type": {
53
+ "type": "keyword"
54
+ }
55
+ }
56
+ }
57
+ }
@@ -5,4 +5,4 @@
5
5
  # invenio-app-ils is free software; you can redistribute it and/or modify it
6
6
  # under the terms of the MIT License; see LICENSE file for more details.
7
7
 
8
- """Invenio Providers ES v6 mappings."""
8
+ """Invenio Providers ES v7 mappings."""
@@ -10,7 +10,5 @@
10
10
  from flask import current_app
11
11
  from werkzeug.local import LocalProxy
12
12
 
13
- current_ils_prov = LocalProxy(
14
- lambda: current_app.extensions["invenio-ils-prov"]
15
- )
13
+ current_ils_prov = LocalProxy(lambda: current_app.extensions["invenio-ils-prov"])
16
14
  """Helper proxy to get the current ILS Providers extension."""
@@ -41,9 +41,7 @@ class IlsRecord(Record):
41
41
  @cached_property
42
42
  def pid(self):
43
43
  """Get the PersistentIdentifier for this record."""
44
- return PersistentIdentifier.get(
45
- pid_type=self._pid_type, pid_value=self["pid"]
46
- )
44
+ return PersistentIdentifier.get(pid_type=self._pid_type, pid_value=self["pid"])
47
45
 
48
46
  @staticmethod
49
47
  def pid_type_to_record_class(pid_type):
@@ -58,13 +56,9 @@ class IlsRecord(Record):
58
56
  pid_type = cls._pid_type
59
57
  else:
60
58
  new_cls = cls.pid_type_to_record_class(pid_type)
61
- return new_cls.get_record_by_pid(
62
- pid_value, with_deleted=with_deleted
63
- )
59
+ return new_cls.get_record_by_pid(pid_value, with_deleted=with_deleted)
64
60
 
65
- resolver = Resolver(
66
- pid_type=pid_type, object_type="rec", getter=cls.get_record
67
- )
61
+ resolver = Resolver(pid_type=pid_type, object_type="rec", getter=cls.get_record)
68
62
  _, record = resolver.resolve(str(pid_value))
69
63
  return record
70
64
 
@@ -22,9 +22,7 @@ class ChangedBySchema(Schema):
22
22
 
23
23
  unknown = EXCLUDE
24
24
 
25
- type = fields.Str(
26
- required=True, validate=validate.OneOf(IlsRecord.CURATOR_TYPES)
27
- )
25
+ type = fields.Str(required=True, validate=validate.OneOf(IlsRecord.CURATOR_TYPES))
28
26
  value = fields.Str()
29
27
 
30
28
 
@@ -0,0 +1,23 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2024 CERN.
4
+ #
5
+ # invenio-app-ils is free software; you can redistribute it and/or modify it
6
+ # under the terms of the MIT License; see LICENSE file for more details.
7
+
8
+ """Identifiers schema for marshmallow loader."""
9
+
10
+ from marshmallow import EXCLUDE, Schema, fields
11
+
12
+
13
+ class IdentifierSchema(Schema):
14
+ """Identifier schema."""
15
+
16
+ class Meta:
17
+ """Meta attributes for the schema."""
18
+
19
+ unknown = EXCLUDE
20
+
21
+ material = fields.Str()
22
+ scheme = fields.Str(required=True)
23
+ value = fields.Str(required=True)
@@ -30,10 +30,7 @@ class MetadataExtensions(object):
30
30
  def validate_basic_marshmallow_type(_type):
31
31
  allowed_types = [Bool, DateString, Integer, SanitizedUnicode]
32
32
  assert any(
33
- [
34
- isinstance(_type, allowed_type)
35
- for allowed_type in allowed_types
36
- ]
33
+ [isinstance(_type, allowed_type) for allowed_type in allowed_types]
37
34
  )
38
35
 
39
36
  marshmallow_type = field_cfg["marshmallow"]
@@ -12,7 +12,10 @@ from flask_principal import ActionNeed, RoleNeed, UserNeed
12
12
  from invenio_access import Permission, any_user
13
13
  from six import string_types
14
14
 
15
- from invenio_app_ils.permissions import backoffice_access_action
15
+ from invenio_app_ils.permissions import (
16
+ backoffice_access_action,
17
+ backoffice_readonly_access_action,
18
+ )
16
19
 
17
20
  create_records_action = ActionNeed("create-records")
18
21
 
@@ -68,7 +71,10 @@ class RecordPermission(Permission):
68
71
  if self.is_public():
69
72
  return [any_user]
70
73
  else:
71
- return self.record_needs() + [backoffice_access_action]
74
+ return self.record_needs() + [
75
+ backoffice_readonly_access_action,
76
+ backoffice_access_action,
77
+ ]
72
78
 
73
79
  def record_explicit_restrictions(self):
74
80
  """Return the list of user ids/roles allowed for the given action."""