https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43723
--- Comment #9 from Jonathan Druart <[email protected]> --- Created attachment 210212 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=210212&action=edit Bug 43723: Only consider flags == 1 as superlibrarian Superlibrarian was detected by testing bit 0 of borrowers.flags (`% 2` in C4::Context::IsSuperLibrarian, `& 2**$bit` in C4::Auth::getuserflags and Koha::Patron->permissions), so any odd value (e.g. 3 or 421) was considered superlibrarian. Only flags == 1 means superlibrarian. Test for that in IsSuperLibrarian, getuserflags and Koha::Patron->permissions, so that haspermission, Koha::Patron->has_permission and is_superlibrarian agree. The other bits of an odd value are still granted (flags=3 gives circulate). The permissions page (members/member-flags.pl) no longer ticks superlibrarian for such values. This changes behaviour for patrons with an odd flags value other than 1, which could come from old entries in the borrowers table that predate the UI change that forbid the selection of superlibrarian together with other top-level permissions. Test plan: 1. Create a staff patron with a username and password, e.g. "flagtest", and give them the "catalogue" permission so they can log in. 2. Set their flags to an odd value other than 1: UPDATE borrowers SET flags = 3 WHERE userid = 'flagtest'; 3. Without the patch: a. Log in to the staff interface as flagtest => You have full access: Administration > System preferences opens b. As koha, open flagtest's "Set permissions" page => "Access to all librarian functions" (superlibrarian) is ticked 4. Apply the patch, restart_all 5. Log in again as flagtest => Circulation is accessible (bit 1 is still granted) => Administration > System preferences is not accessible (permission denied), and the Administration link is not shown 6. As koha, open flagtest's "Set permissions" page => superlibrarian is not ticked, "circulate" is ticked Note: saving this page will store flags = 2 (superlibrarian bit removed) 7. UPDATE borrowers SET flags = 1 WHERE userid = 'flagtest'; Log in again as flagtest => Full access again: flags = 1 is still superlibrarian 8. Run the tests: prove t/Context.t t/db_dependent/Koha/Patron.t t/db_dependent/Auth.t \ t/db_dependent/Koha/Patrons.t t/db_dependent/Koha/Patrons/Import.t => All pass Co-Authored-By: Claude Opus 5.5 <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
