Bug 15173 - SubfieldsToAllowForRestrictedEditing not working properly
Summary: SubfieldsToAllowForRestrictedEditing not working properly
Status: Pushed to Stable
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Julian Maurice
URL:
Whiteboard:
Keywords:
Depends on: 7673 12176
Blocks:
  Show dependency treegraph
 
Reported: 2015-11-11 13:21 UTC by Jessie Zairo
Modified: 2017-10-29 18:11 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:


Attachments
Bug 15173: Restore SubfieldsToAllowForRestrictedEditing (8.30 KB, patch)
2016-08-16 14:14 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 15173: Restore SubfieldsToAllowForRestrictedEditing (9.57 KB, patch)
2017-09-05 20:21 UTC, Lee Jamison
Details | Diff | Splinter Review
Bug 15173: Restore SubfieldsToAllowForRestrictedEditing (9.64 KB, patch)
2017-09-29 09:19 UTC, Julian Maurice
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jessie Zairo 2015-11-11 13:21:10 UTC
We have found an issue where the system preference "SubfieldsToAllowForRestrictedEditing" is not properly restricting permissions. Based on what we are seeing, I suspect it has something to do with drop down vs. free text fields. Drop down fields are locked from editing, free text fields are not being locked properly. We are trying to disable editing on 952$2, 952$a, 952$b, 952$e, 952$h, 952$o. The first three fields (which are all drop downs) are locked properly. The last three fields (which are free text) are still editable by users with the restricted editing permission.

This system preference is identical in set-up with 'SubfieldsToAllowForRestrictedBatchmod' and that system preference is working properly with the same input values.
Comment 1 Jonathan Druart 2016-08-16 13:50:55 UTC
This bug has been introduced by bug 12176.
Comment 2 Jonathan Druart 2016-08-16 14:14:10 UTC
Created attachment 54511 [details] [review]
Bug 15173: Restore SubfieldsToAllowForRestrictedEditing

Bug 7673 introduced SubfieldsToAllowForRestrictedEditing but bug 12176
broke it assuming that only selects were impacted by this feature.

Test plan:
Go back on bug 7673 and confirm that
SubfieldsToAllowForRestrictedEditing is working as expected with this
patch applied.
Comment 3 Claire Gravely 2016-10-13 08:00:15 UTC
testing this I found that before applying patch I was able to edit all free text fields as reported. 

After applying the patch I could not edit anything, even with the exceptions defined in SubfieldsToAllowForRestrictedEditing.
Comment 4 Jonathan Druart 2017-08-31 16:37:20 UTC
It works for me, please try again, you must be logged with a non-superlibrarian users and have editcatalogue => edit_items_restricted
Comment 5 Lee Jamison 2017-09-05 20:21:14 UTC
Created attachment 66856 [details] [review]
Bug 15173: Restore SubfieldsToAllowForRestrictedEditing

Bug 7673 introduced SubfieldsToAllowForRestrictedEditing but bug 12176
broke it assuming that only selects were impacted by this feature.

Test plan:
Go back on bug 7673 and confirm that
SubfieldsToAllowForRestrictedEditing is working as expected with this
patch applied.

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
For clarification, the item fields that are entered in
SubfieldsToAllowForRestrictedEditing should EXCLUDE the desired
fields you want to disable.

Test plan (updated to test the scenario in the bug Description):
1. Create a patron with only the following permissions:
    - catalogue (Required for staff login)
    - editcatalogue -> edit_catalogue
    - editcatalogue -> edit_items
    - editcatalogue -> edit_items_restricted
2. Navigate to Administration -> Global system preferences -> Cataloging
    -> Record Structure -> SubfieldsToAllowForRestrictedEditing
3. In the input field for SubfieldsToAllowForRestrictedEditing enter in
    all the 952 fields EXCEPT the ones desired to be disabled. In this
    case, we want to disallow editing of 952$2, 952$a, 952$b, 952$e, 952$h,
    and 952$o so we enter the following into the
    SubfieldsToAllowForRestrictedEditing (without quotes) "952$0 952$1
    952$3 952$4 952$5 952$7 952$8 952$c 952$d 952$f 952$g 952$i 952$j
    952$p 952$t 952$u 952$v 952$w 952$x 952$y 952$z"
4. Click Save all Cataloging preferences
5. Login to the staff client as the created restricted editing patron
6. Edit an item
7. Note that all fields except for the ones excluded from the syspref
    are editable
Comment 6 Julian Maurice 2017-09-29 09:19:24 UTC
Created attachment 67434 [details] [review]
Bug 15173: Restore SubfieldsToAllowForRestrictedEditing

Bug 7673 introduced SubfieldsToAllowForRestrictedEditing but bug 12176
broke it assuming that only selects were impacted by this feature.

Test plan:
Go back on bug 7673 and confirm that
SubfieldsToAllowForRestrictedEditing is working as expected with this
patch applied.

Signed-off-by: Lee Jamison <ldjamison@marywood.edu>
For clarification, the item fields that are entered in
SubfieldsToAllowForRestrictedEditing should EXCLUDE the desired
fields you want to disable.

Test plan (updated to test the scenario in the bug Description):
1. Create a patron with only the following permissions:
    - catalogue (Required for staff login)
    - editcatalogue -> edit_catalogue
    - editcatalogue -> edit_items
    - editcatalogue -> edit_items_restricted
2. Navigate to Administration -> Global system preferences -> Cataloging
    -> Record Structure -> SubfieldsToAllowForRestrictedEditing
3. In the input field for SubfieldsToAllowForRestrictedEditing enter in
    all the 952 fields EXCEPT the ones desired to be disabled. In this
    case, we want to disallow editing of 952$2, 952$a, 952$b, 952$e, 952$h,
    and 952$o so we enter the following into the
    SubfieldsToAllowForRestrictedEditing (without quotes) "952$0 952$1
    952$3 952$4 952$5 952$7 952$8 952$c 952$d 952$f 952$g 952$i 952$j
    952$p 952$t 952$u 952$v 952$w 952$x 952$y 952$z"
4. Click Save all Cataloging preferences
5. Login to the staff client as the created restricted editing patron
6. Edit an item
7. Note that all fields except for the ones excluded from the syspref
    are editable

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Comment 7 Julian Maurice 2017-09-29 09:22:54 UTC
Note that restricted borrowers are still able to edit every subfields if they know how to use a browser to manipulate the DOM (removing the 'readonly' attribute is enough).
But that may be fixed in another bug.
Comment 8 Jonathan Druart 2017-09-29 15:45:20 UTC
Pushed to master for 17.11, thanks to everybody involved!
Comment 9 Fridolin SOMERS 2017-10-25 08:06:53 UTC
Pushed to 17.05.x, will be in 17.05.06.
Comment 10 Katrin Fischer 2017-10-29 18:11:16 UTC
This patch has been pushed to 16.11.x and will be in 16.11.14.