]> git.koha-community.org Git - koha.git/commit
Bug 31389: Calculate user permissions in separate function
authorDavid Cook <dcook@prosentient.com.au>
Thu, 18 Aug 2022 03:26:20 +0000 (03:26 +0000)
committerTomas Cohen Arazi <tomascohen@theke.io>
Thu, 22 Sep 2022 11:39:21 +0000 (08:39 -0300)
commit897fe2068330db89d0c4ce93e85cc00c889eebca
tree473e6c8b3a1cf02e3f9e51e9729e5d4a16fbe46c
parent734c8fe70ec5d025f9341bb46339d2d0fe3cc42f
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>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
C4/Auth.pm
Koha/Auth/Permissions.pm [new file with mode: 0644]
t/Koha/Auth/Permissions.t [new file with mode: 0755]