[Bug 30178] New: Every librarian can edit every item with IndependentBranches on
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 Bug ID: 30178 Summary: Every librarian can edit every item with IndependentBranches on Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: major Priority: P5 - low Component: Cataloging Assignee: koha-bugs@lists.koha-community.org Reporter: januszop@gmail.com QA Contact: testopia@bugs.koha-community.org CC: m.de.rooy@rijksmuseum.nl Problem arises after applying bugfix #27526: with IndependentBranches on, a librarian without superlibrarian privileges, can edit every item (i.e. also from a foreign branch). This is because can_be_edited calculation is buggy. A patch will follow. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 --- Comment #1 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 131090 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131090&action=edit [SOLVED] Every librarian can edit every item with IndependentBranches on Test plan: ========= 1. Have (at least) two branches defined. 2. Have IndependentBranches set. 3. Have a biblio record with items belonging to different branches. 4. Be a librarian without superlibrarian rights. 5. Go to Edit -> Edit items view (cataloguing/additems.pl). 6. You will be able to edit every item, also ones not from the branch you are from. 7. Apply the patch. 8. Repeat 5. 9. You should be able to edit only the items from your branch. -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |januszop@gmail.com |ity.org | CC| |jonathan.druart+koha@gmail. | |com Priority|P5 - low |P2 Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |fridolin.somers@biblibre.co | |m --- Comment #2 from Fridolin Somers <fridolin.somers@biblibre.com> --- Thanks for this patch. You also need to fix : koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc Please have a look at how we write commit/patch messages : https://wiki.koha-community.org/wiki/Commit_messages -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |27526 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=27526 [Bug 27526] Remove Mod/AddItemFromMarc from additem.pl -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 Janusz Kaczmarek <januszop@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #131090|0 |1 is obsolete| | --- Comment #3 from Janusz Kaczmarek <januszop@gmail.com> --- Created attachment 131123 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131123&action=edit Bug 30178: (bugs 27526 and 28445 follow-up) Every librarian can edit every item with IndependentBranches on Additionally, problems caused by koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc are resolved. Fridolin, thank you for pointing that out. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |28445 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28445 [Bug 28445] Use the task queue for the batch delete and update items tool -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 --- Comment #4 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- This changes sub GetLoggedInBranchcode to GetLoggedInBranchname, but doesn't this mean that GetLoggedInBranchcode is wrong? But this doesn't feel right as we compare to item.homebranch, which should be the code? Something here is for sure confusing. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 --- Comment #5 from Janusz Kaczmarek <januszop@gmail.com> --- Katrin, you are right, it is confusing. I wish it was a branch code, but it is not--it is the name. Have a look at columns_to_str here (cataloguing/additem.pl): my @items; for my $item ( $biblio->items->as_list, $biblio->host_items->as_list ) { push @items, $item->columns_to_str; } It took me some time to figure this out. The values of item.homebranch are then put directly into the table for users, so--I guess--it has been decided to pass this like this... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Janusz Kaczmarek from comment #5)
Katrin, you are right, it is confusing. I wish it was a branch code, but it is not--it is the name. Have a look at columns_to_str here (cataloguing/additem.pl):
my @items; for my $item ( $biblio->items->as_list, $biblio->host_items->as_list ) { push @items, $item->columns_to_str; }
It took me some time to figure this out. The values of item.homebranch are then put directly into the table for users, so--I guess--it has been decided to pass this like this...
We just arrived at the same spot :) I first confirmed it by adding the line to the templates: [% item.homebranch %] | [% Branches.GetLoggedInBranchname() %] So the fix is correct, but I feel we might want to revisit this confusing variable at some point. Changing code to name is an easy template task, so passing it like this appears not necessary. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 --- Comment #7 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- And great commit message now btw! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 --- Comment #8 from Janusz Kaczmarek <januszop@gmail.com> --- One could add for testing a line like this: [% Koha.Preference('IndependentBranches') %] // [% logged_in_user.is_superlibrarian %] // [% item.homebranch %] // [% Branches.GetLoggedInBranchname() ) %] // [% Branches.GetLoggedInBranchcode() ) %] </br> next to "SET can_be_edited" to see the actual values on the web page... -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #131123|0 |1 is obsolete| | --- Comment #9 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 131137 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131137&action=edit Bug 30178: (bugs 27526 and 28445 follow-up) Every librarian can edit every item with IndependentBranches on Problem arises after applying bugfix 27526 and 28445: with IndependentBranches on, a librarian without superlibrarian privileges, can edit (and potentially delete) every item (i.e. also from a foreign branch). This is because can_be_edited calculation is buggy (in two spots). Test plan: 1. Have (at least) two branches defined. 2. Have IndependentBranches set. 3. Have a biblio record with items belonging to different branches. 4. Be a librarian without superlibrarian rights, with editcatalogue and tool permissions set. Scenario A (Edit items): 1. Go to Edit -> Edit items view (cataloguing/additems.pl). 2. You will be able to edit every item, also ones not from the branch you are from (cf. the button 'Actions'). 3. Apply the patch. 4. Repeat 1. 5. You should be able to edit only the items from your branch. Scenario B (Edit items in batch): 1. From Normal view go to Edit -> Edit items in batch. 2. You will be able to batch edit every item, also ones not from the branch you are from. 3. Apply the patch. 4. Repeat 1. 5. You should be able to edit only the items from your branch (and see 'Cannot edit' for others. Scenario C (Delete items in batch): 1. From Normal view go to Edit -> Delete items in batch. 2. You will not see the string 'Cannot delete' and only by chance will not be able to activate the checkboxes next to foreign items. 3. Apply the patch. 4. Repeat 1. 5. You should be able to delete only the items from your branch (and see 'Cannot delete' for others. Scenario D and E: Analogous steps can be executed from Tools -> Batch item modification and Tools -> Batch item deletion Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 --- Comment #10 from Janusz Kaczmarek <januszop@gmail.com> ---
We just arrived at the same spot :) I first confirmed it by adding the line to the templates:
[% item.homebranch %] | [% Branches.GetLoggedInBranchname() %]
So the fix is correct, but I feel we might want to revisit this confusing variable at some point. Changing code to name is an easy template task, so passing it like this appears not necessary.
The more that the use of GetLoggedInBranchname creates a possible security issue in a malignant case of two different branches with the same name. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 --- Comment #11 from Fridolin Somers <fridolin.somers@biblibre.com> --- Maybe we should create a Koha::Patron method can_edit_item(), like can_log_into() -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 --- Comment #12 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- (In reply to Fridolin Somers from comment #11)
Maybe we should create a Koha::Patron method can_edit_item(), like can_log_into()
I had similar thoughts - but I think we could treat this as an urgent bug fix maybe and I'll file another bug for centralizing the code? I believe it would make sense, but might create a bigger/more conflict-prone patch set if done right. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 --- Comment #13 from Fridolin Somers <fridolin.somers@biblibre.com> --- Sure, another bug report for long-term fix is good. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #131137|0 |1 is obsolete| | --- Comment #14 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 131182 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=131182&action=edit Bug 30178: (bugs 27526 and 28445 follow-up) Every librarian can edit every item with IndependentBranches on Problem arises after applying bugfix 27526 and 28445: with IndependentBranches on, a librarian without superlibrarian privileges, can edit (and potentially delete) every item (i.e. also from a foreign branch). This is because can_be_edited calculation is buggy (in two spots). Test plan: 1. Have (at least) two branches defined. 2. Have IndependentBranches set. 3. Have a biblio record with items belonging to different branches. 4. Be a librarian without superlibrarian rights, with editcatalogue and tool permissions set. Scenario A (Edit items): 1. Go to Edit -> Edit items view (cataloguing/additems.pl). 2. You will be able to edit every item, also ones not from the branch you are from (cf. the button 'Actions'). 3. Apply the patch. 4. Repeat 1. 5. You should be able to edit only the items from your branch. Scenario B (Edit items in batch): 1. From Normal view go to Edit -> Edit items in batch. 2. You will be able to batch edit every item, also ones not from the branch you are from. 3. Apply the patch. 4. Repeat 1. 5. You should be able to edit only the items from your branch (and see 'Cannot edit' for others. Scenario C (Delete items in batch): 1. From Normal view go to Edit -> Delete items in batch. 2. You will not see the string 'Cannot delete' and only by chance will not be able to activate the checkboxes next to foreign items. 3. Apply the patch. 4. Repeat 1. 5. You should be able to delete only the items from your branch (and see 'Cannot delete' for others. Scenario D and E: Analogous steps can be executed from Tools -> Batch item modification and Tools -> Batch item deletion Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA CC| |martin.renvoize@ptfs-europe | |.com --- Comment #15 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Well sleuthed, this was hard to trace. I've confirmed the fix works and I can't find any regressions. Lets get this one pushed as a matter of urgency and continue tidying up in a further bug.. I'll leave Katrin and Fridolin to report that new bug. So.. Passing QA, thanks for the patch Janusz -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |22.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 --- Comment #16 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to master for 22.05, thanks to everybody involved 🦄 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30178 Andrew Fuerste-Henry <andrew@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|22.05.00 |22.05.00,21.11.04 released in| | Status|Pushed to master |RESOLVED Resolution|--- |FIXED CC| |andrew@bywatersolutions.com --- Comment #17 from Andrew Fuerste-Henry <andrew@bywatersolutions.com> --- I see this is in 21.11. Missing dependency, not backported to 21.05 -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org