https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16631

Casey Conlin <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #190752|0                           |1
        is obsolete|                            |

--- Comment #111 from Casey Conlin <[email protected]> ---
Created attachment 191602
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=191602&action=edit
Bug 16631: Institute library limits

This patch implements the library_limit concept for Report/Reports. Staff with
the correct permission and superlibrarians can set libaries to which the report
should be visible, if the system preference is enabled.

    Test plan:

    Confirm Initial Settings
    1. Log in to Koha staff with username: koha and password: koha and set your
library as Centerville if it’s not already.
    2. Visit the Saved reports page, and create and save three reports: Report
1, Report 2, and Report 3. The SQL query for each report doesn't matter, it
should just be something valid.
    3. Visit the Patrons page and create two staff users: StaffReportLimitUser
and StaffNoLimitPermission. Set their home libraries to Centerville and
Fairfield, respectively.
    4. Under Allow access to the reports module, ensure both users have report
management permissions for Create, Delete, Execute.

    Verify Patch Settings
    5. Apply the patch, then Restart services.
    6. Click Patrons in the top navbar to go to the Patrons page.
    7. Search for “StaffReportLimitUser” in the patron search field.
    8. Click StaffReportLimitUser to edit the patron record for this user.
    9. Click More -> Set permissions to access the permissions screens for the
StaffReportLimitUser.
    10. In the row for Allow access to the reports module (reports), click Show
details to view relevant permissions.
    11. Confirm Manage Report Limits (manage_report_limits) is an option under
Allow access to the reports module (reports).
    12. Click the checkbox for Manage Report Limits to give this user this
permission, and click Save.
    13. Go to the System Preferences page (Click the More dropdown from the top
nav bar, click Administration, click System Preferences).
    14. Verify Reports is an option in the left side navigation bar, and that
when clicked, you see the LimitReportsByBranch option.
    15. Enable LimitReportsByBranch as described in step 14.
    16. Go back to Saved reports as in Step 2.
    17. Click Edit in the row menu for Report 1.
    18. At the bottom of the Report 1 edit page, you should see a Library
limitation select box.

    Verify the Library Limitation Settings are Persisted
    19. Choose Centerville from the select box and click Update SQL.
    20. Reload the page, or navigate away from the page and go back to the edit
screen for Report 1.
    21. Verify that Centerville is still in the Library limitation select box.
    22. Add Fairfield in the Library limitation select box and click Update and
run SQL.
    23. Go back to editing Report 1.
    24. Confirm the Library limitation select box has both Centerville and
Fairfield selected.
    25. Duplicate Report 1.
    26. Confirm the Library limitation select box has both Centerville and
Fairfield selected.
    27. Click Save Report.
    28. Confirm the Library limitation select box has both Centerville and
Fairfield selected.

    Verify Reports are Limited Based on Library Limitations
    29. Edit Report 1 to add Centerville in the Library limitation select box
as the only choice and click Update SQL.
    30. Edit Report 2 to add Fairfield in the Library limitation select box as
the only choice and click Update SQL.
    31. Report 3 should have no library limitations, so it should be visible to
all libraries.
    32. Go to Saved reports as in Step 2.
    33. Confirm you do not see Report 2, and only Report 1 and Report 3.
    34. In the upper right corner, click the drop down that says koha
Centerville and click Set library to change your library.
    35. Set your library to Fairfield.
    36. Go to Saved reports as in Step 2.
    37. Confirm you do not see Report 1, and only Report 2 and Report 3.

    Verify Disabling LimitReportsByBranch Preference Shows All Reports
    38. Disable LimitReportsByBranch preference as in steps 13 to 15.
    39. Go to Saved reports as in Step 2.
    40. Confirm Report 1, Report 2, Report 3 are visible.
    41. Click to edit Report 1 and verify there is no Library limitation select
box.

    Verify Library limitations are Persisted When EnableFilteringReports is
Toggled On or Off
    42. Enable EnableFilteringReports preference as in steps 13 to 15.
    43. Ensure your library is set to Fairfield as in step 35.
    44. Go to Saved reports as in Step 2.
    45. Confirm Report 1 is not visible, and Report 2 and Report 3 are visible.
    46. Click to edit Report 2 and verify the Library limitation select box is
at the bottom of the page and that it has Fairfield selected.

    Verify the Show all reports option shows all reports for users with the
Manage Report Limits permission and superlibrarians
    47. Go to Saved reports as in Step 2 and in the Show reports dropdown,
select Show all reports, and click Apply filter.
    48. Confirm the page reloads with all reports visible:  Report 1, Report 2,
and Report 3 should be visible.
    49. Select Show my branch reports from the dropdown and click Apply filter.
    50. Confirm Report 1 is not visible, and Report 2 and Report 3 are visible
(you should only see reports for your branch, Fairfield).

    Verify Report filters return the correct results
    51. Go to Saved reports as in Step 2.
    52. Verify you’re viewing only your branch’s reports in the filter.
    53. Under Filter in the left sidebar, type “2” in the Keyword field and
click Apply filter.
    54. Confirm only Report 2 is visible.
    55. Under Filter in the left sidebar, type “1” in the Keyword field and
click Apply filter.
    56. Confirm there are no reports visible, and the message "No saved reports
match your criteria" is displayed.

    Verify Library Limits column is available to superlibrarians and users with
the Manage Report Limits permission
    57. Go to Saved reports as in Step 2.
    58. Click the Columns dropdown and ensure that the Library limits column is
available to select for display. Select it.
    59. Confirm that the Library limits column is now visible in the list of
reports and that it shows the correct library limitations for each report
(e.g., Report 1 should show 1 library limitation and Centerville (CPL) on
hover, Report 2 should show 1 library limitation and Fairfield (FFL) on hover,
and Report 3 should show no limitation).

    Verify the Show all reports and Limit reports options are available to
users that are not superlibrarian but have the Manage Report Limits permission
    60. For the StaffReportLimitUser, add the permission for Manage Report
Limits as described in steps 9 to 12. This will allow this user to see the Show
all reports and Limit reports options.
    61. Log out of the koha admin account. In the upper right corner, click the
drop down that says koha Fairfield and click Log out.
    62. Log in as StaffReportLimitUser, the previously created staff user with
report permissions.
    63. Confirm the staff user’s library is Centerville in the upper right
corner of the screen.
    64. Go to Saved reports as in Step 2.
    65. Confirm the filter option for Show reports is visible.
    66. Click to edit Report 1.
    67. Verify there is a Library limitation select box and that it can be
interacted with.

    Verify the Show all reports and Limit reports options are not available to
users that are not superlibrarian and do not have the Manage Report Limits
permission
    68. Log out of the StaffReportLimitUser account.
    69. Log in as a previously created staff user without report permissions.
    70. Confirm the staff user’s library is Fairfield in the upper right corner
of the screen.
    71. Go to Saved reports as in Step 2.
    72. Click the Columns dropdown and ensure that the Library limits column is
not in the list of available columns to select for display.
    73. Confirm the filter option for Show reports is not available.
    74. Click to edit Report 2.
    75. Verify there is no Library limitation select box at the bottom of the
page.

    Verify limited reports are not visible to users without permissions
    76. Log out of the staff user account without permissions.
    77. Log in as a superlibrarian or a user with the Manage Report Limits
permission.
    78. Copy the URL for the edit page of Report 1, and log out of the
superlibrarian or user with permissions account.
    79. Log in as, StaffNoLimitPermission, the user without the Manage Report
Limits permission.
    80. Paste the copied URL for the edit page of Report 1 into the browser and
navigate to it.
    81. Confirm that you see an error message that says "This report is
restricted and cannot be accessed by the current user." and that the page does
not load the report details.

    Run Unit Tests
    82. Using Koha Testing Docker, in the Koha home directory run the command:
ktd --shell to start the ktd shell.
    83. Run command: reset_all to drop and recreate the koha database.
    84. Run command prove t/db_dependent/Koha/Reports.t to run the test.
    85. The new unit tests for the reports_branches tables are in this file.
    86. All tests should pass.
    87. Run command prove t/Koha/Auth/Permissions.t
    88. Permissions unit tests in this file were updated.
    89. All tests should pass
    90. Run command prove t/db_dependent/Reports/Guided.t
    91. The Guided report tests were updated to account for the new library
limitations and permissions.
    92. All tests should pass.

    Signoff
    93. Sign off if the steps above check out.

Sponsored-by: Ramapo Catskill Library System
Co-authored-by: Casey Conlin <[email protected]>

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to