- Add a read-only field - The read-only field will only be editable by superlibrarian - Koha can update these internally for related routines
Hi Nick, could you share some details about the use cases for this one? As we usually don't give superlibrarian permissions to users, could this be tied to a new permission maybe?
(In reply to Katrin Fischer from comment #1) > Hi Nick, could you share some details about the use cases for this one? > As we usually don't give superlibrarian permissions to users, could this be > tied to a new permission maybe? We also talked about a new permission, that should not be a problem. The idea here is really the ability to lock records from certain sources - in this case the library will be cataloging in an external system and pushing records in to Koha. They do not wish for these records to be edited within Koha, so want to protect them - with a limited set of users being able to edit them if the need arises.
Ah! That makes a lot of sense and could be useful in our use case as well. Are you thinking of some kind of automatism to set the locked maybe on import too?
(In reply to Katrin Fischer from comment #3) > Are you thinking of some kind of automatism to set the locked maybe on > import too? On the API front, this will be a flag to be passed, with (probably) some default for each source i.e. there will be an 'Import sources' crud page, to set this things.
+1 I would like to see this functionality. There's a number of times we import data from other systems into Koha, and the place to correct that data is upstream, so it would flow into Koha.
This should probably be based on ( or at least informed by ) bug 20256 which does a fair amount of refactoring.
Created attachment 163371 [details] [review] Bug 35919: Add Koha::Biblio::Metadata->source_allows_editing This patch adds a convenient method that tells if the record is editable, according to it's record source. To test: 1. Apply this patch 2. Run: $ ktd k$ prove t/db_dependent/Koha/Biblio/Metadata.t => SUCCESS: Tests pass! Use cases covered! 3. Sign off :-D Signed-off-by: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> Bug 31791: Rename can_be_edited -> source_allows_editing
Created attachment 163372 [details] [review] Bug 31791: DB changes Sponsored-by: ByWater Solutions
Created attachment 163373 [details] [review] Bug 31791: Add TT plugin method Biblio.CanBeEdited Sponsored-by: ByWater Solutions
Created attachment 163374 [details] [review] Bug 31791: Add record locking based on source Sponsored-by: ByWater Solutions
Created attachment 163375 [details] [review] Bug 31791: Add edit_locked_records and set_record_sources subpermissions Sponsored-by: ByWater Solutions
Created attachment 163376 [details] [review] Bug 31791: Limit editing locked records Sponsored-by: ByWater Solutions
Created attachment 163377 [details] [review] Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc) Sponsored-by: ByWater Solutions
Created attachment 163378 [details] [review] Bug 31791: Add x-record-source-id header to POST /biblios This patch adds support for setting the record source on the API. It does so by adding support for a new header `x-record-source-id`. Setting the record source is restricted to patrons with the `set_record_sources` permission. A 403 error is returned on an attempt to set it without the correct permissions. The feature is documented on the spec. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/biblios.t => SUCCESS: Tests pass! Tests cover the right use cases! 3. Play with Postman (or similar) 4. Sign off :-D Sponsored-by: ByWater Solutions
The submitted patches implement the requested feature, paired with the 'record sources' feature. Test plan: 1. Have bug 35919 applied 2. Apply this patchset 3. Create 2 'Record sources' in the Administration section * Record source A having edition disabled * Record source B having edition enabled Take notes on the record source ID for each. 4. Create a valid staff member (known user and pass) 5. Have the user set the following permissions: - catalogue (staff access) - editcatalogue => all subpermissions bug `edit_locked_records` 6. Login with the user on a private/incognito browser 7. Pick a record and browse to it on the private browser => SUCCESS: You can edit it 8. Make the record source for the chosen record be A: $ koha-mysql kohadev > UPDATE biblio_metadata SET record_source_id=<A's ID> WHERE biblionumber=<chosen record>; 9. Refresh the private window => SUCCESS: You are redirected to an error page 10. Search for the chosen record 11. Try to edit it => SUCCESS: The 'Edit record' link is greyed and cannot be used => SUCCESS: The greyed text has a tooltip explaining what's going on 12. Either change the record source to B, or just edit the record source A to allow editing 13. Refresh the record detail page => SUCCESS: The 'Edit record' link is no longer greyed, and the record can be edited => SUCCESS: Record edition is limited by source configuration 14. Verify superlibrarians can always edit such records Note: the only way to set the record source for now is the API, which is extensively tested on the provided tests (t/db_dependent/api/v1/biblios.t
Created attachment 163405 [details] [review] Bug 31791: Add Koha::Biblio->can_be_edited Sponsored-by: ByWater Solutions
Created attachment 163408 [details] [review] Bug 31791: DB changes Sponsored-by: ByWater Solutions
Created attachment 163410 [details] [review] Bug 31791: Add TT plugin method Biblio.CanBeEdited Sponsored-by: ByWater Solutions
Created attachment 163411 [details] [review] Bug 31791: Add record locking based on source Sponsored-by: ByWater Solutions
Created attachment 163413 [details] [review] Bug 31791: Add edit_locked_records and set_record_sources subpermissions Sponsored-by: ByWater Solutions
Created attachment 163414 [details] [review] Bug 31791: Limit editing locked records Sponsored-by: ByWater Solutions
Created attachment 163415 [details] [review] Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc) Sponsored-by: ByWater Solutions
Created attachment 163416 [details] [review] Bug 31791: Add x-record-source-id header to POST /biblios This patch adds support for setting the record source on the API. It does so by adding support for a new header `x-record-source-id`. Setting the record source is restricted to patrons with the `set_record_sources` permission. A 403 error is returned on an attempt to set it without the correct permissions. The feature is documented on the spec. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/biblios.t => SUCCESS: Tests pass! Tests cover the right use cases! 3. Play with Postman (or similar) 4. Sign off :-D Sponsored-by: ByWater Solutions
Created attachment 163426 [details] [review] Bug 31791: Add Koha::Biblio->can_be_edited Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163427 [details] [review] Bug 31791: DB changes Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163428 [details] [review] Bug 31791: Add TT plugin method Biblio.CanBeEdited Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163429 [details] [review] Bug 31791: Add record locking based on source Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163430 [details] [review] Bug 31791: Add edit_locked_records and set_record_sources subpermissions Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163431 [details] [review] Bug 31791: Limit editing locked records Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163432 [details] [review] Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc) Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163433 [details] [review] Bug 31791: Add x-record-source-id header to POST /biblios This patch adds support for setting the record source on the API. It does so by adding support for a new header `x-record-source-id`. Setting the record source is restricted to patrons with the `set_record_sources` permission. A 403 error is returned on an attempt to set it without the correct permissions. The feature is documented on the spec. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/biblios.t => SUCCESS: Tests pass! Tests cover the right use cases! 3. Play with Postman (or similar) 4. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163434 [details] [review] Bug 31791: Remove CanBeEdited template helper We've opted to rely on the objects directly in templates whenever we can now. As such, I opt to remove this new template helper and use the object method directly instead. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
All working great.. I added a small follow-up to remove the CanBeEdited helper as we can just use the object methods directly in the templates. Signing off.
PS. We can squash my follow-up btw.. it'll throw git manipulation errors in the QA scripts as it stands.. though I tend to like the extra info of a commit myself.. but that's personal preference.. I know others prefer less commits.
Created attachment 163531 [details] [review] Bug 31791: Add Koha::Biblio->can_be_edited Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163532 [details] [review] Bug 31791: DB changes Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163533 [details] [review] Bug 31791: Add record locking based on source Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163534 [details] [review] Bug 31791: Add edit_locked_records and set_record_sources subpermissions Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163535 [details] [review] Bug 31791: Limit editing locked records Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163536 [details] [review] Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc) Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163537 [details] [review] Bug 31791: Add x-record-source-id header to POST /biblios This patch adds support for setting the record source on the API. It does so by adding support for a new header `x-record-source-id`. Setting the record source is restricted to patrons with the `set_record_sources` permission. A 403 error is returned on an attempt to set it without the correct permissions. The feature is documented on the spec. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/biblios.t => SUCCESS: Tests pass! Tests cover the right use cases! 3. Play with Postman (or similar) 4. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 163538 [details] [review] Bug 31791: Add Koha::Biblio::Metadata->record_source This patch adds a method for retrieving the related *Koha::RecordSource* from a *Koha::Biblio::Metadata* object. The method is covered by tests: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Biblio/Metadata.t => SUCCESS: Tests pass! 3. Sign off :-D Sponsored-by: ByWater Solutions
Created attachment 163539 [details] [review] Bug 31791: Display record source on the detail view
(In reply to Martin Renvoize from comment #33) > All working great.. I added a small follow-up to remove the CanBeEdited > helper as we can just use the object methods directly in the templates. Oh, an oversight of mine. I had written this code before that decision was made! (In reply to Martin Renvoize from comment #34) > PS. We can squash my follow-up btw Done!
I wanted to note that theres a 'tidy' warning regarding the C4::Biblio changes. They would only go away by tidying the entire sub, as the problem is my patch is adding lines to a fully untidy block. I'll submit a follow-up for tidying it all, but I wouldn't push it myself. Up to the RM.
Created attachment 163545 [details] [review] Bug 31791: (follow-up) Tidy AddBiblio Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 164193 [details] [review] Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc) Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 164194 [details] [review] Bug 31791: Add x-record-source-id header to POST /biblios This patch adds support for setting the record source on the API. It does so by adding support for a new header `x-record-source-id`. Setting the record source is restricted to patrons with the `set_record_sources` permission. A 403 error is returned on an attempt to set it without the correct permissions. The feature is documented on the spec. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/biblios.t => SUCCESS: Tests pass! Tests cover the right use cases! 3. Play with Postman (or similar) 4. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 164195 [details] [review] Bug 31791: Add Koha::Biblio::Metadata->record_source This patch adds a method for retrieving the related *Koha::RecordSource* from a *Koha::Biblio::Metadata* object. The method is covered by tests: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Biblio/Metadata.t => SUCCESS: Tests pass! 3. Sign off :-D Sponsored-by: ByWater Solutions
Created attachment 164196 [details] [review] Bug 31791: Display record source on the detail view
Created attachment 164197 [details] [review] Bug 31791: (follow-up) Tidy AddBiblio Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Rebased on top of bug 34943, currently in master.
Created attachment 164696 [details] [review] Bug 31791: Add Koha::Biblio->can_be_edited Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 164697 [details] [review] Bug 31791: DB changes Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 164698 [details] [review] Bug 31791: Add record locking based on source Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 164699 [details] [review] Bug 31791: Add edit_locked_records and set_record_sources subpermissions Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 164700 [details] [review] Bug 31791: Limit editing locked records Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 164701 [details] [review] Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc) Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 164702 [details] [review] Bug 31791: Add x-record-source-id header to POST /biblios This patch adds support for setting the record source on the API. It does so by adding support for a new header `x-record-source-id`. Setting the record source is restricted to patrons with the `set_record_sources` permission. A 403 error is returned on an attempt to set it without the correct permissions. The feature is documented on the spec. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/biblios.t => SUCCESS: Tests pass! Tests cover the right use cases! 3. Play with Postman (or similar) 4. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 164703 [details] [review] Bug 31791: Add Koha::Biblio::Metadata->record_source This patch adds a method for retrieving the related *Koha::RecordSource* from a *Koha::Biblio::Metadata* object. The method is covered by tests: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Biblio/Metadata.t => SUCCESS: Tests pass! 3. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 164704 [details] [review] Bug 31791: Display record source on the detail view Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Created attachment 164705 [details] [review] Bug 31791: (follow-up) Tidy AddBiblio Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Upgrading my SO to a QA.. I've thoroughly tested again, QA scripts are happy and tests coverage is good. I can see lots of refinements for the future I'll add as bugs now. Great work
Created attachment 165044 [details] [review] Bug 31791: Add Koha::Biblio->can_be_edited Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Created attachment 165045 [details] [review] Bug 31791: DB changes Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Created attachment 165046 [details] [review] Bug 31791: Add record locking based on source Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Created attachment 165047 [details] [review] Bug 31791: Add edit_locked_records and set_record_sources subpermissions Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Created attachment 165048 [details] [review] Bug 31791: Limit editing locked records Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Created attachment 165049 [details] [review] Bug 31791: Add 'source_record_id' param to {Add,Mod}Biblio(Marc) Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Created attachment 165050 [details] [review] Bug 31791: Add x-record-source-id header to POST /biblios This patch adds support for setting the record source on the API. It does so by adding support for a new header `x-record-source-id`. Setting the record source is restricted to patrons with the `set_record_sources` permission. A 403 error is returned on an attempt to set it without the correct permissions. The feature is documented on the spec. To test: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/api/v1/biblios.t => SUCCESS: Tests pass! Tests cover the right use cases! 3. Play with Postman (or similar) 4. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Created attachment 165051 [details] [review] Bug 31791: Add Koha::Biblio::Metadata->record_source This patch adds a method for retrieving the related *Koha::RecordSource* from a *Koha::Biblio::Metadata* object. The method is covered by tests: 1. Apply this patch 2. Run: $ ktd --shell k$ prove t/db_dependent/Koha/Biblio/Metadata.t => SUCCESS: Tests pass! 3. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Created attachment 165052 [details] [review] Bug 31791: Display record source on the detail view Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Created attachment 165053 [details] [review] Bug 31791: (follow-up) Tidy AddBiblio Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Added my signoff, this is very good work and we have a use case for this. Would be nice to have some interface to change the record source from staff interface but there is an attached bug for that (bz36372)
If I understand correctly, this patch set makes the record locks work, but they still need to be set in the database or by API. I am mostly OK with that, but we also add a permission for "Set record source" and this doesn't seem to be included yet. Maybe we should comment/remove it for now?
Talked to Tomas: we will try to finish bug 36373. If we don't manage in time for 24.05, we can add a little note to the permission that it's only relevant for API users for now.
Pushed for 24.05! Well done everyone, thank you!
Created attachment 165697 [details] [review] Bug 31791: (follow-up) Fix Permissions.t Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Not backported to 23.11.x
I'd really like some release notes for this one as it's not so self explanatory.
There is a query on the mailing list about how to use this new feature: https://lists.katipo.co.nz/pipermail/koha/2024-June/060730.html I've had a crack at responding, but if I've not got it right could someone involved provide some more information? Thanks.
(In reply to David Nind from comment #81) > There is a query on the mailing list about how to use this new feature: > https://lists.katipo.co.nz/pipermail/koha/2024-June/060730.html > > I've had a crack at responding, but if I've not got it right could someone > involved provide some more information? > > Thanks. I'm not seeing the email on my inbox!
(In reply to Tomás Cohen Arazi from comment #82) > (In reply to David Nind from comment #81) > > There is a query on the mailing list about how to use this new feature: > > https://lists.katipo.co.nz/pipermail/koha/2024-June/060730.html > > > > I've had a crack at responding, but if I've not got it right could someone > > involved provide some more information? > > > > Thanks. > > I'm not seeing the email on my inbox! I've received both of them - maybe a problem with spam?
I did my best to understand and describe this new feature (along with bug 35919). Please see the merge request and let me know if I what I wrote is wrong! https://gitlab.com/koha-community/koha-manual/-/merge_requests/887