https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43723
--- Comment #8 from Martin Renvoize (ashimema) <[email protected]> --- Jonathan, Nick, Paul: I tested this series on KTD (main as of 30 Oct, plus the four bug 43425 patches and the two patches here) and I think Paul's question in comment 7 needs an answer before this can move. I ran Paul's snippet for a few flags values: flags=1: IsSuperLibrarian=1 getuserflags=1 haspermission=1 is_superlibrarian=1 flags=3: IsSuperLibrarian=0 getuserflags=1 haspermission=1 is_superlibrarian=1 flags=421: IsSuperLibrarian=0 getuserflags=1 haspermission=1 is_superlibrarian=1 On main (% 2) IsSuperLibrarian agrees with the other checks for all three. After the first patch here it no longer does for any odd value other than 1. The commit message of the first patch says "test it with & 1 like the other flag checks ... no behaviour change expected", but the diff changes `% 2` to `== 1 ? 1 : 0`, and t/Context.t asserts that flags=421 is not a superlibrarian. So the message and the code disagree. The follow-up only restores `& 1` in Koha/Patrons/Import.pm, so the series ends up treating any odd value as superlibrarian in the import check but only exactly 1 in IsSuperLibrarian. Which one is intended? 1. Superlibrarian is bit 0, so any odd value counts. This matches the commit message and getuserflags, haspermission, has_permission and is_superlibrarian. The change would be `( $userenv->{flags} // 0 ) & 1` in C4::Context::IsSuperLibrarian, and the t/Context.t assertion for flags=421 would flip to 1. 2. Only exactly 1 counts. Then the other four checks would need to change as well, otherwise they keep granting superlibrarian to flags=3. I'd suggest 1, since it removes the disagreement without touching the other checks. If you agree, I'm happy to prepare the follow-up (the one-line change plus the test update). Separately, bug 43425 passes on its own against current main (Import.t 182/182, koha-qa clean) and already checks the superlibrarian bit itself, so it doesn't need to wait for this one. -- 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/
