Bug 26322: [19.11.x] Permissions not checked correctly for plugins
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 31 Aug 2020 12:43:09 +0000 (09:43 -0300)
committerAleisha Amohia <aleishaamohia@hotmail.com>
Mon, 21 Sep 2020 22:15:23 +0000 (10:15 +1200)
commit57bb4ee95e6f144bf34fbf4b67e148e551343fee
tree4a0483b0c358c2dc831d9b8bb082663f03715453
parent4241305b759511ec47766887910ce6f01740be18
Bug 26322: [19.11.x] Permissions not checked correctly for plugins

This patch fixes the logic in a condition to address the fact that
permissions are not checked for plugins. This was due to bad parenthesis
pairing and the lack of good tests for this.

To test:
1. Apply the regression tests patch
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/REST/Plugin/PluginRoutes.t
=> FAIL: Tests fail because of bad logic
3. Apply this patch
4. Repeat (2)
=> SUCCESS: Tests pass!
5. Verify the tests cover the use cases that are needed:
   - Anonymous access
   - Real user with wrong permissions (parameters => 1)
   - Real user with right permissions (borrowers => 1)
=> SUCCESS: Needed use cases so we catch any regression are found
6. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Koha/REST/V1/Auth.pm