Summary: | C4::Auth->haspermission should allow checking for more than one subpermission | ||
---|---|---|---|
Product: | Koha | Reporter: | Nick Clemens (kidclamp) <nick> |
Component: | Architecture, internals, and plumbing | Assignee: | Nick Clemens (kidclamp) <nick> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | enhancement | ||
Priority: | P5 - low | CC: | martin.renvoize |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=22484 | ||
Change sponsored?: | --- | Patch complexity: | Small patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Bug Depends on: | |||
Bug Blocks: | 20128, 22483 | ||
Attachments: |
Bug 22031: Unit tests
Bug 22031: Adjust haspermission to take an array Bug 22031: Add SQL::Abstract like syntax to haspermission Bug 22031: Add SQL::Abstract like syntax to haspermission Bug 22031: Add SQL::Abstract like syntax to haspermission |
Description
Nick Clemens (kidclamp)
2018-12-20 13:40:48 UTC
Created attachment 83414 [details] [review] Bug 22031: Unit tests To test: 1 - Apply this patch only 2 - prove -v t/db_dependent/Auth/haspermission.t 3 - It will fail Created attachment 83415 [details] [review] 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 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. Created attachment 83474 [details] [review] 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. My last attachment is an alternative implementation (and includes additional tests). Let me know what you think Nick. I think this is fantastic, it will need documentation but should expand ability to use/combine permissions. Excellent work! Created attachment 86197 [details] [review] 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> Created attachment 86204 [details] [review] 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> Awesome work all! Pushed to master for 19.05 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. Enhancement, will not be backported to 18.11.x series. |