[Bug 31389] New: Calculate user permissions in separate function
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 Bug ID: 31389 Summary: Calculate user permissions in separate function Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Architecture, internals, and plumbing Assignee: koha-bugs@lists.koha-community.org Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org C4::Auth::get_template_and_user() is an extremely long function. By decomposing it into functions, it becomes easier to test and re-use those functions elsewhere. The current calculation of "CAN_user_*" is also inefficient and contains some unused code, so this would help to clean it up. -- 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=31389 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |dcook@prosentient.com.au |ity.org | -- 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=31389 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=27342 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |31380 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31380 [Bug 31380] Build Mojolicious controller for running Koha plugins -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 --- Comment #1 from David Cook <dcook@prosentient.com.au> --- Created attachment 139311 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=139311&action=edit Bug 31389: Calculate user permissions in separate function This patch refactors the setting of user permissions for templates into a new function, which can be easily unit tested and reduces the amount of code in C4::Auth::get_template_and_user(). It also aids in the re-usability of permission checking code. Test plan: 0) Apply patch and koha-plack --restart kohadev 1) prove t/Koha/Auth/Permissions.t 2) As koha superlibrarian, go to http://localhost:8081/cgi-bin/koha/tools/tools-home.pl 3) Go to http://localhost:8081/cgi-bin/koha/members/members-home.pl 4) Create new test user with "Staff access..." and "Remaining circulation permissions" 5) Logout of koha superlibrarian 6) Login as test user 7) Note you can only see a limited view of the staff interface (i.e. no administration, no tools, no reports, etc.) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #139311|0 |1 is obsolete| | --- Comment #2 from David Cook <dcook@prosentient.com.au> --- Created attachment 139326 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=139326&action=edit Bug 31389: Calculate user permissions in separate function This patch refactors the setting of user permissions for templates into a new function, which can be easily unit tested and reduces the amount of code in C4::Auth::get_template_and_user(). It also aids in the re-usability of permission checking code. Test plan: 0) Apply patch and koha-plack --restart kohadev 1) prove t/Koha/Auth/Permissions.t 2) As koha superlibrarian, go to http://localhost:8081/cgi-bin/koha/tools/tools-home.pl 3) Go to http://localhost:8081/cgi-bin/koha/members/members-home.pl 4) Create new test user with "Staff access..." and "Remaining circulation permissions" 5) Logout of koha superlibrarian 6) Login as test user 7) Note you can only see a limited view of the staff interface (i.e. no administration, no tools, no reports, etc.) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- 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=31389 Kyle M Hall <kyle@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #139326|0 |1 is obsolete| | --- Comment #3 from Kyle M Hall <kyle@bywatersolutions.com> --- Created attachment 139398 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=139398&action=edit Bug 31389: Calculate user permissions in separate function This patch refactors the setting of user permissions for templates into a new function, which can be easily unit tested and reduces the amount of code in C4::Auth::get_template_and_user(). It also aids in the re-usability of permission checking code. Test plan: 0) Apply patch and koha-plack --restart kohadev 1) prove t/Koha/Auth/Permissions.t 2) As koha superlibrarian, go to http://localhost:8081/cgi-bin/koha/tools/tools-home.pl 3) Go to http://localhost:8081/cgi-bin/koha/members/members-home.pl 4) Create new test user with "Staff access..." and "Remaining circulation permissions" 5) Logout of koha superlibrarian 6) Login as test user 7) Note you can only see a limited view of the staff interface (i.e. no administration, no tools, no reports, etc.) Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 Victor Grousset/tuxayo <victor@tuxayo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Small patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 Joonas Kylmälä <joonas.kylmala@iki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #139398|0 |1 is obsolete| | --- Comment #4 from Joonas Kylmälä <joonas.kylmala@iki.fi> --- Created attachment 140202 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=140202&action=edit Bug 31389: Calculate user permissions in separate function This patch refactors the setting of user permissions for templates into a new function, which can be easily unit tested and reduces the amount of code in C4::Auth::get_template_and_user(). It also aids in the re-usability of permission checking code. Test plan: 0) Apply patch and koha-plack --restart kohadev 1) prove t/Koha/Auth/Permissions.t 2) As koha superlibrarian, go to http://localhost:8081/cgi-bin/koha/tools/tools-home.pl 3) Go to http://localhost:8081/cgi-bin/koha/members/members-home.pl 4) Create new test user with "Staff access..." and "Remaining circulation permissions" 5) Logout of koha superlibrarian 6) Login as test user 7) Note you can only see a limited view of the staff interface (i.e. no administration, no tools, no reports, etc.) Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 --- Comment #5 from Joonas Kylmälä <joonas.kylmala@iki.fi> --- Created attachment 140203 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=140203&action=edit Bug 31389: (QA follow-up) Correct test message The test in question concerns non-superlibrarian staff users. Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 Joonas Kylmälä <joonas.kylmala@iki.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joonas.kylmala@iki.fi --- Comment #6 from Joonas Kylmälä <joonas.kylmala@iki.fi> --- Looks good to me but I want one more sign-off from the QA team since this change concerns authorization. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #140202|0 |1 is obsolete| | --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 140563 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=140563&action=edit Bug 31389: Calculate user permissions in separate function This patch refactors the setting of user permissions for templates into a new function, which can be easily unit tested and reduces the amount of code in C4::Auth::get_template_and_user(). It also aids in the re-usability of permission checking code. Test plan: 0) Apply patch and koha-plack --restart kohadev 1) prove t/Koha/Auth/Permissions.t 2) As koha superlibrarian, go to http://localhost:8081/cgi-bin/koha/tools/tools-home.pl 3) Go to http://localhost:8081/cgi-bin/koha/members/members-home.pl 4) Create new test user with "Staff access..." and "Remaining circulation permissions" 5) Logout of koha superlibrarian 6) Login as test user 7) Note you can only see a limited view of the staff interface (i.e. no administration, no tools, no reports, etc.) Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> 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=31389 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #140203|0 |1 is obsolete| | --- Comment #8 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 140564 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=140564&action=edit Bug 31389: (QA follow-up) Correct test message The test in question concerns non-superlibrarian staff users. Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> 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=31389 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA CC| |martin.renvoize@ptfs-europe | |.com --- Comment #9 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Second QA run done.. this is a nice little cleanup. Passed. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 --- Comment #10 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Created attachment 140844 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=140844&action=edit Bug 31389: (QA follow-up) Missing permissions in tests The following bugs refined permissions a bit, and the change was missing on the tests: * 23681 * 30335 Bonus: sorted permissions alphabetically for readability. Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 Tomás Cohen Arazi <tomascohen@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)| |22.11.00 released in| | Status|Passed QA |Pushed to master -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 --- Comment #11 from Tomás Cohen Arazi <tomascohen@gmail.com> --- Pushed to master for 22.11. Nice work everyone, thanks! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED CC| |lucas@bywatersolutions.com Status|Pushed to master |RESOLVED --- Comment #12 from Lucas Gass <lucas@bywatersolutions.com> --- Enhancement will not be backported to 22.05.x series -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 --- Comment #13 from David Cook <dcook@prosentient.com.au> --- In hindsight, there is 1 test missing. For "normal staff user test", I should've included "'reports' => 1" and then checked that it all the sub-permissions authorizations. I've opened bug 32064 to include that missing test. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=31389 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |32064 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=32064 [Bug 32064] Add missing test to template permission calculation -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org