[Bug 14540] New: Move member-flags.pl to PermissionsManager to better manage permissions for testing.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Bug ID: 14540 Summary: Move member-flags.pl to PermissionsManager to better manage permissions for testing. Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Authentication Assignee: gmcharlt@gmail.com Reporter: olli-antti.kivilahti@jns.fi QA Contact: testopia@bugs.koha-community.org CC: dpavlin@rot13.org Currently there is no nice way to grant/revoke permissions for Borrowers in Koha. This is a big problem when doing integration testing and when working with permissions using the future REST API. Currently we have one web-script, member-flags.pl, which deals with all permission-related things. Basically it always DELETEs all your permissions and then adds them again with some modifications. There is no internal API for creating permissions and this makes automated testing significantly harder. To create permissions for a test borrower, we must decrypt the arcane way of creating koha.borrowers.flags and add user_permissions with brittle SQL-queries. This makes for very messy test scripts, and quite frankly this is hardly ever done in Koha. Also the koha.borrowers.flags-column is pretty horrible. It is 19-bit binary array where each bit tells of the borrower has all permissions for the respective permission module. This is very difficult to calculate and the mechanism is hard to understand. This feature is also unnecessary, since we are always interested in having the specific permissions. We don't need to know if one Borrower has all the permissions for one module. Also what happens if more subpermissions are added to the module? Existing all-permission-holders lose their all-permissions-status? Instead we could have a nice internal API to work with permissions. My patch introduces a new database structure for permissions (not necessarily better), Koha::Object implementation of the DB structure, and most importantly, a Koha::Auth::PermissionManager which is a gateway to all permissions-related actions. This feature is well tested with unit tests and PageObject integration tests. See the tests for usage examples. Especially the t/db_dependent/Members/member-flags.t I hope you like it :) VOCABULARY: Module (permission_modules) => a module which consists of specific Permissions. Typically covers one Module in Koha. Permission (permission) => a specific Permission of a Module. Granting a Borrower the permission to do something. Borrower permission (borrower_permissions) => A specific Permission a specific Borrower has, eg. the permission to edit bibliographic records. TEST PLAN: -2. Note the permissions a bunch of borrowers has. -1. run updatedatabase.pl 0. Observe that those borrowers still have the same permissions. For modules which didn't have any subpermissions, a generic subpermission is added and the borrowers should have it if they had the existing module permission. Basic login: 1. Go to Koha staff client 2. Make a password login. 3. Browse to any other staff client pages to confirm that the session is active and login persists on other pages. Modify permissions: 1. Go to member-flags.pl (Home › Patrons › Set permissions) 2. Change your permissions. Save. 3. Go back to member-flags.pl 4. Observe that you see the same permissions you just set. Modify superlibrarian permission: 1. Go to member-flags.pl (Home › Patrons › Set permissions) 2. Give the superlibrarian-permission. Observe all other permissions vanishing. Save. 3. Go back to member-flags.pl 4. Observe that you see only the superlibrarian-permission active. 5. Observe that the superlibrarian permission is the only top-level permission which doesn't have any subpermissions. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 --- Comment #1 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41030 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41030&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager to better manage permissions for testing. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |13995, 13906, 14495, 14536, | |14539 Referenced Bugs: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13906 [Bug 13906] TestObjectFactory(ies) for Koha objects. Enable easy Test object creation from HASHes or from preconfigured test groups. http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13995 [Bug 13995] Proper Exception handling http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14495 [Bug 14495] WebDriver/WebTester Factory for easy generation of Web testing UserAgents. http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14536 [Bug 14536] PageObject-pattern base implementation http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14539 [Bug 14539] Introduction to castToObject(), aka. make a Koha::Object from various input types -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|gmcharlt@gmail.com |olli-antti.kivilahti@jns.fi -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41030|0 |1 is obsolete| | --- Comment #2 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41051 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41051&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager to better manage permissions for testing. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41051|0 |1 is obsolete| | --- Comment #3 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41055 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41055&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager to better manage permissions for testing. Documentation improvements. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 --- Comment #4 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41056 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41056&action=edit A sketch of the permissions improvements. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41055|0 |1 is obsolete| | --- Comment #5 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41059 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41059&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager to better manage permissions for testing. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41059|0 |1 is obsolete| | --- Comment #6 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41062 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41062&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager to better manage permissions for testing. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41062|0 |1 is obsolete| | --- Comment #7 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41071 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41071&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager to better manage permissions for testing. Fixed the updatedatabase.pl Added tests for superuser login. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |benjamin.rokseth@kul.oslo.k | |ommune.no --- Comment #8 from Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> --- Great work, Olli! And cheers to this approach to a very annoying lack! Will test as soon as possible. One suggestion, though: patching updatedatabase.pl is no longer neccesary: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13068 Documented on wiki: http://wiki.koha-community.org/wiki/Database_updates#New_workflow_since_bug_... We're already using it, as we need multiple patches with database updates, and it greatly simplifies testing. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 --- Comment #9 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- (In reply to Benjamin Rokseth from comment #8)
Great work, Olli! And cheers to this approach to a very annoying lack! Will test as soon as possible. Thank you for the kind words Benjamin! Sometimes it is very hard to guess how the community will react to things :)
I am also rewriting the authentication system. Or more like deprecating most of it and creating a new more modular system. There is already a lot of work in it and it works well. Integrating it to the legacy systems is really difficult, but you can see the code in Bug 7174 - Authentication rewriting. That published code is not git bz apply:able yet, but I am working on it to support the most used legacy authentication mechanisms and work really well with the new REST API :) I'll take a look at the atomicupdates! -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Jacek Ablewicz <abl@biblos.pk.edu.pl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |abl@biblos.pk.edu.pl -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41071|0 |1 is obsolete| | --- Comment #10 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41123 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41123&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager to better manage permissions for testing. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |7174 Referenced Bugs: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7174 [Bug 7174] Authentication rewriting -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Zeno Tajoli <z.tajoli@cineca.it> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |http://bugs.koha-community. | |org/bugzilla3/show_bug.cgi? | |id=13906 Depends on|13906 | CC| |z.tajoli@cineca.it Referenced Bugs: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13906 [Bug 13906] TestObjectFactory(ies) for Koha objects. Enable easy Test object creation from HASHes or from preconfigured test groups. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41123|0 |1 is obsolete| | --- Comment #11 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41158 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41158&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager to better manage permissions for testing. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41158|0 |1 is obsolete| | --- Comment #12 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41255 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41255&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager to better manage permissions for testing. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41255|0 |1 is obsolete| | --- Comment #13 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41258 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41258&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager to better manage permissions for testing. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41258|0 |1 is obsolete| | --- Comment #14 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41310 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41310&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager to better manage permissions for testing. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41310|0 |1 is obsolete| | --- Comment #15 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41402 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41402&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager to better manage permissions for testing. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41402|0 |1 is obsolete| | --- Comment #16 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 41535 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=41535&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager to better manage permissions for testing. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Zeno Tajoli <z.tajoli@cineca.it> changed: What |Removed |Added ---------------------------------------------------------------------------- Patch complexity|--- |Large patch CC|z.tajoli@cineca.it | -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 --- Comment #17 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 42390 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=42390&action=edit Bug 14540 - PermissionManager - Followup fix sample_patrons.sql -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #41535|0 |1 is obsolete| | Attachment #42390|0 |1 is obsolete| | --- Comment #18 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 42410 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=42410&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager to better manage permissions for testing. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 --- Comment #19 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 42432 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=42432&action=edit Bug 14540 - Followup regression test for bad login -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #42432|0 |1 is obsolete| | --- Comment #20 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 42434 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=42434&action=edit Bug 14540 - Followup regression test for bad login -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 --- Comment #21 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 42550 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=42550&action=edit Bug 14540 - PermissionManager - Hotfix check_api_auth, remove flags. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Jacek Ablewicz <ablewicz@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ablewicz@gmail.com -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 --- Comment #22 from Olli-Antti Kivilahti <olli-antti.kivilahti@jns.fi> --- Created attachment 44490 --> http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=44490&action=edit Bug 14540 - Move member-flags.pl to PermissionsManager. Recover from changed userid mid-session. -- You are receiving this mail because: You are watching all bug changes.
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14540 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jonathan.druart@bugs.koha-c | |ommunity.org Status|Needs Signoff |BLOCKED -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org