Bug 14437 - Refactor C4::Auth::haspermission() to Koha::Object and return better errors.
Summary: Refactor C4::Auth::haspermission() to Koha::Object and return better errors.
Status: CLOSED INVALID
Alias: None
Product: Koha
Classification: Unclassified
Component: Authentication (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Olli-Antti Kivilahti
QA Contact: Testopia
URL:
Keywords:
Depends on: 13995
Blocks: 13920
  Show dependency treegraph
 
Reported: 2015-06-23 09:17 UTC by Olli-Antti Kivilahti
Modified: 2016-06-21 21:37 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 14437 - Refactor C4::Auth::haspermission() to Koha::Object and return better errors. (9.08 KB, patch)
2015-06-23 09:18 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Bug 14437 - Refactor C4::Auth::haspermission() to Koha::Object and return better errors. (9.09 KB, patch)
2015-06-24 10:35 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Bug 14437 - Refactor C4::Auth::haspermission() to Koha::Object and return better errors. (9.34 KB, patch)
2015-06-29 12:38 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review
Bug 14437 - Refactor C4::Auth::haspermission() to Koha::Object and return better errors. (9.34 KB, patch)
2015-06-29 13:22 UTC, Olli-Antti Kivilahti
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Olli-Antti Kivilahti 2015-06-23 09:17:11 UTC
Refactoring haspermission() and improving documentation.
Also added a return value unintrusively (in the old context still RETURNS the same result) to tell which permission failed.

Modification should have no adverse effects, other than killing the process (by throwing uncaught exceptions) if no valid parameters are given.

Depends on Bug 13995 - Proper Exception handling
    so apply it first.

Cannot create unit tests because there is no CRUD interface for permissions. Not even with TestBuilder.

TEST PLAN:

1. Find a borrower with only the catalogue-permission.
2. try opening this page cgi-bin/koha/tools/manage-marc-import.pl
3. You get "Permission denied"
Comment 1 Olli-Antti Kivilahti 2015-06-23 09:18:19 UTC Comment hidden (obsolete)
Comment 2 Olli-Antti Kivilahti 2015-06-24 10:35:26 UTC Comment hidden (obsolete)
Comment 3 Olli-Antti Kivilahti 2015-06-29 12:38:11 UTC Comment hidden (obsolete)
Comment 4 Olli-Antti Kivilahti 2015-06-29 13:22:03 UTC
Created attachment 40719 [details] [review]
Bug 14437 - Refactor C4::Auth::haspermission() to Koha::Object and return better errors.
Comment 5 Jonathan Druart 2015-07-02 15:01:55 UTC
Comment on attachment 40719 [details] [review]
Bug 14437 - Refactor C4::Auth::haspermission() to Koha::Object and return better errors.

Review of attachment 40719 [details] [review]:
-----------------------------------------------------------------

::: C4/Auth.pm
@@ +38,5 @@
>  use List::MoreUtils qw/ any /;
>  use Encode qw( encode is_utf8);
>  
> +use Koha::Exception::BadParameter;
> +use Koha::Exception::UnknownObject;

So should depend on bug 13995.
Comment 6 Olli-Antti Kivilahti 2015-07-17 10:00:59 UTC
This Bug is deprecated because of Bug 14540.