[Bug 22031] New: C4::Auth->haspermission should allow checking for more than one subpermission
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 Bug ID: 22031 Summary: C4::Auth->haspermission should allow checking for more than one subpermission 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: nick@bywatersolutions.com QA Contact: testopia@bugs.koha-community.org Target Milestone: --- Currently we can only check one subpermission per module It would be nice to check multiple Testing code suggests this was possible, however, it was flawed flagsrequired => { tools => 'batch_upload_patron_images', tools => 'upload_local_cover_images' } Above does not test for two permissions, it simply checks for the second -- 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=22031 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Patch complexity|--- |Small patch -- 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=22031 --- Comment #1 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 83414 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=83414&action=edit Bug 22031: Unit tests To test: 1 - Apply this patch only 2 - prove -v t/db_dependent/Auth/haspermission.t 3 - It will fail -- 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=22031 --- Comment #2 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 83415 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=83415&action=edit Bug 22031: Adjust haspermission to take an array To test: 1 - Apply this patch on top of unit tests 2 - Unit tests now pass 3 - Ensure you can use Koha as before with no regressions -- 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=22031 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Severity|enhancement |normal Assignee|koha-bugs@lists.koha-commun |nick@bywatersolutions.com |ity.org | -- 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=22031 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |20128 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20128 [Bug 20128] Permission for advanced editor -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com --- Comment #3 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- This works well enough... But.. what if we wanted to introduce the ability to compare logically with OR or AND in the future.. by adding arrayref as 'AND' here we'll be doing the exact opposite of what SQL::Abstract does... I'm going to try and come up with an alternative that more closely resembles SQL::Abstract so we're not dealing with two very similar but opposing constructs in Koha. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 --- Comment #4 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Created attachment 83474 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=83474&action=edit Bug 22031: Add SQL::Abstract like syntax to haspermission This patch adds an SQL::Abstract inspired query syntax to the haspermission method in C4::Auth. One can now pass Arrayrefs to denote an OR list of flags, a Hashref to denote a AND list of flags. Structures can be nested at arbitrary depth. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 --- Comment #5 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- My last attachment is an alternative implementation (and includes additional tests). Let me know what you think Nick. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #83414|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #83415|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 --- Comment #6 from Nick Clemens <nick@bywatersolutions.com> --- I think this is fantastic, it will need documentation but should expand ability to use/combine permissions. Excellent work! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 Nick Clemens <nick@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=22031 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #83474|0 |1 is obsolete| | --- Comment #7 from Nick Clemens <nick@bywatersolutions.com> --- Created attachment 86197 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=86197&action=edit Bug 22031: Add SQL::Abstract like syntax to haspermission This patch adds an SQL::Abstract inspired query syntax to the haspermission method in C4::Auth. One can now pass Arrayrefs to denote an OR list of flags, a Hashref to denote a AND list of flags. Structures can be nested at arbitrary depth. Signed-off-by: Nick Clemens <nick@bywatersolutions.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 Jonathan Druart <jonathan.druart@bugs.koha-community.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #86197|0 |1 is obsolete| | --- Comment #8 from Jonathan Druart <jonathan.druart@bugs.koha-community.org> --- Created attachment 86204 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=86204&action=edit Bug 22031: Add SQL::Abstract like syntax to haspermission This patch adds an SQL::Abstract inspired query syntax to the haspermission method in C4::Auth. One can now pass Arrayrefs to denote an OR list of flags, a Hashref to denote a AND list of flags. Structures can be nested at arbitrary depth. Signed-off-by: Nick Clemens <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 Nick Clemens <nick@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to Master --- Comment #9 from Nick Clemens <nick@bywatersolutions.com> --- Awesome work all! Pushed to master for 19.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 --- Comment #10 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Hi Nick, Wow, really pleased to see this one going through.. I thought it might come up against a bit more opposition :). So.. you mention additional documentation.. did you have any thoughts on what you might like.. some examples in the POD perhaps or were you thinking something on the wiki? I'm happy to oblige. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Blocks| |22483 Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22483 [Bug 22483] haspermissions used to support passing 'undef' for $flagsrequired -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://bugs.koha-community | |.org/bugzilla3/show_bug.cgi | |?id=22484 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22031 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |FIXED Status|Pushed to Master |RESOLVED Severity|normal |enhancement --- Comment #11 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Enhancement, will not be backported to 18.11.x series. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org