This is a consequence of a big change introduced by bug 25045
*** Bug 25484 has been marked as a duplicate of this bug. ***
Created attachment 104968 [details] [review] Bug 25411: Regression tests This patch adds tests the new RESTPublicAnonymousRequests syspref doesn't apply to routes added by plugins. It is up to the plugin developer to handle those conditions. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t => FAIL: Notice the tests fail
Created attachment 104969 [details] [review] Bug 25411: Add special handling for public plugin routes This patch implements the required logic in the API code so plugins are not affected by the new RESTPublicAnonymousRequests system preference. It is up to the plugin develpers to handle this To test: 1. Apply the tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t => FAIL: Notice the tests fail 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! Yay! Not bad for a friday evening! 5. Sign off :-D Sponsored-by: ByWater Solutions
Created attachment 104978 [details] [review] Bug 25411: Regression tests This patch adds tests the new RESTPublicAnonymousRequests syspref doesn't apply to routes added by plugins. It is up to the plugin developer to handle those conditions. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t => FAIL: Notice the tests fail Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Created attachment 104979 [details] [review] Bug 25411: Add special handling for public plugin routes This patch implements the required logic in the API code so plugins are not affected by the new RESTPublicAnonymousRequests system preference. It is up to the plugin develpers to handle this To test: 1. Apply the tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t => FAIL: Notice the tests fail 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! Yay! Not bad for a friday evening! 5. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
It works, and hooray for tests first :)
Whoops, wrong status.
Created attachment 105155 [details] [review] Bug 25411: Regression tests This patch adds tests the new RESTPublicAnonymousRequests syspref doesn't apply to routes added by plugins. It is up to the plugin developer to handle those conditions. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t => FAIL: Notice the tests fail Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 105156 [details] [review] Bug 25411: Add special handling for public plugin routes This patch implements the required logic in the API code so plugins are not affected by the new RESTPublicAnonymousRequests system preference. It is up to the plugin develpers to handle this To test: 1. Apply the tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t => FAIL: Notice the tests fail 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! Yay! Not bad for a friday evening! 5. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 105157 [details] [review] Bug 25411: Group conditions in if elsif Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(In reply to Jonathan Druart from comment #10) > Created attachment 105157 [details] [review] [review] > Bug 25411: Group conditions in if elsif > > Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Thanks, my initial implementation was a bit more complex (it involved forcing a new layout on the plugins side) and when I rolled it back I forgot this).
I've only skimmed the code, but it looks good at a glance. For a second, I thought it was making all plugin API routes public, but then I noticed that's only if they don't have 'x-koha-authorization' defined. I wonder if there's anything we need or can do in the API documentation to make it more obvious what (plugin) routes require auth and which don't?
(In reply to David Cook from comment #12) > I've only skimmed the code, but it looks good at a glance. > > For a second, I thought it was making all plugin API routes public, but then > I noticed that's only if they don't have 'x-koha-authorization' defined. > > I wonder if there's anything we need or can do in the API documentation to > make it more obvious what (plugin) routes require auth and which don't? Just a general question. Not directly related to this bug report per se...
Nice work everyone! Pushed to master for 20.05
missing dependencies, not backported to 19.11.x
Created attachment 106084 [details] [review] [19.11.x] Bug 25411: Regression tests This patch adds tests the new RESTPublicAnonymousRequests syspref doesn't apply to routes added by plugins. It is up to the plugin developer to handle those conditions. To test: 1. Apply this patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t => FAIL: Notice the tests fail Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 106085 [details] [review] [19.11.x] Bug 25411: Add special handling for public plugin routes This patch implements the required logic in the API code so plugins are not affected by the new RESTPublicAnonymousRequests system preference. It is up to the plugin develpers to handle this To test: 1. Apply the tests patch 2. Run: $ kshell k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t => FAIL: Notice the tests fail 3. Apply this patch 4. Repeat 2 => SUCCESS: Tests pass! Yay! Not bad for a friday evening! 5. Sign off :-D Sponsored-by: ByWater Solutions Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Aleisha, only the [19.11.x] patches here.
backported to 19.11.x for 19.11.07
Missing dependencies for 19.05.x, can't backport.