Bugzilla – Attachment 55088 Details for
Bug 14868
REST API: Swagger2-driven permission checking
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14868: (QA followup) Change permission check order
Bug-14868-QA-followup-Change-permission-check-orde.patch (text/plain), 1.78 KB, created by
Tomás Cohen Arazi (tcohen)
on 2016-08-31 23:46:29 UTC
(
hide
)
Description:
Bug 14868: (QA followup) Change permission check order
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2016-08-31 23:46:29 UTC
Size:
1.78 KB
patch
obsolete
>From 1f3d37f8fdd0f59b1eb84fdb13dbecb58bd3e43d Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 31 Aug 2016 20:11:05 -0300 >Subject: [PATCH] Bug 14868: (QA followup) Change permission check order > >This patch changes the permission check order because haspermission >is the smaller check, and going through the patron/user and its guaranteed >before checking if it is (say) a staff member or even a superlibrarian doesn't >seem right. > >Bonus: Remove unneeded C4::Auth import in Patron.pm > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > Koha/REST/V1.pm | 5 ++--- > Koha/REST/V1/Patron.pm | 1 - > 2 files changed, 2 insertions(+), 4 deletions(-) > >diff --git a/Koha/REST/V1.pm b/Koha/REST/V1.pm >index 03342d4..4509819 100644 >--- a/Koha/REST/V1.pm >+++ b/Koha/REST/V1.pm >@@ -81,11 +81,10 @@ sub authenticate_api_request { > } > > my $authorization = $action_spec->{'x-koha-authorization'}; >- return $next->($c) if allow_owner($c, $authorization, $user); >- return $next->($c) if allow_guarantor($c, $authorization, $user); >- > my $permissions = $authorization->{'permissions'}; > return $next->($c) if C4::Auth::haspermission($user->userid, $permissions); >+ return $next->($c) if allow_owner($c, $authorization, $user); >+ return $next->($c) if allow_guarantor($c, $authorization, $user); > return $c->render_swagger( > { error => "Authorization failure. Missing required permission(s).", > required_permissions => $permissions }, >diff --git a/Koha/REST/V1/Patron.pm b/Koha/REST/V1/Patron.pm >index a66dbb9..b97a154 100644 >--- a/Koha/REST/V1/Patron.pm >+++ b/Koha/REST/V1/Patron.pm >@@ -19,7 +19,6 @@ use Modern::Perl; > > use Mojo::Base 'Mojolicious::Controller'; > >-use C4::Auth qw( haspermission ); > use Koha::Patrons; > > sub list { >-- >2.9.3
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14868
:
42761
|
52577
|
52578
|
52579
|
52592
|
52593
|
52594
|
52602
|
52603
|
52604
|
52963
|
52964
|
52965
|
52966
|
52967
|
52981
|
52992
|
52993
|
52994
|
52995
|
52996
|
54457
|
54458
|
54459
|
54631
|
54632
|
54633
|
54765
|
54766
|
54767
|
54770
|
54771
|
54894
|
54895
|
54896
|
54897
|
55084
|
55085
|
55086
|
55087
|
55088
|
55089
|
55099
|
55100
|
55101
|
55102
|
55103
|
55104
|
55105