Bugzilla – Attachment 50917 Details for
Bug 15126
REST API: Use newer version of Swagger2
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15126: x-mojo-controller deprecation
0002-Bug-15126-x-mojo-controller-deprecation.patch (text/plain), 5.18 KB, created by
Kyle M Hall (khall)
on 2016-04-28 13:27:40 UTC
(
hide
)
Description:
Bug 15126: x-mojo-controller deprecation
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2016-04-28 13:27:40 UTC
Size:
5.18 KB
patch
obsolete
>From ae1e0a3a8e5100c4608102a0d40fa8045b70c991 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 7 Oct 2015 14:49:17 +0000 >Subject: [PATCH 2/4] Bug 15126: x-mojo-controller deprecation > >Remove the use of soon to be deprecated x-mojo-controller from our >specification and replace with the recommended operationId format. > >Signed-off-by: Benjamin Rokseth <benjamin.rokseth@kul.oslo.kommune.no> > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > Koha/REST/V1/Patron.pm | 58 +++++++++++++++++++++++++++++++++++++++++++++++++ > Koha/REST/V1/Patrons.pm | 58 ------------------------------------------------- > api/v1/swagger.json | 2 -- > 3 files changed, 58 insertions(+), 60 deletions(-) > create mode 100644 Koha/REST/V1/Patron.pm > delete mode 100644 Koha/REST/V1/Patrons.pm > >diff --git a/Koha/REST/V1/Patron.pm b/Koha/REST/V1/Patron.pm >new file mode 100644 >index 0000000..2851308 >--- /dev/null >+++ b/Koha/REST/V1/Patron.pm >@@ -0,0 +1,58 @@ >+package Koha::REST::V1::Patron; >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it under the >+# terms of the GNU General Public License as published by the Free Software >+# Foundation; either version 3 of the License, or (at your option) any later >+# version. >+# >+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >+# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with Koha; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >+ >+use Modern::Perl; >+ >+use Mojo::Base 'Mojolicious::Controller'; >+ >+use C4::Auth qw( haspermission ); >+use Koha::Patrons; >+ >+sub list { >+ my ($c, $args, $cb) = @_; >+ >+ my $user = $c->stash('koha.user'); >+ unless ($user && haspermission($user->userid, {borrowers => 1})) { >+ return $c->$cb({error => "You don't have the required permission"}, 403); >+ } >+ >+ my $patrons = Koha::Patrons->search; >+ >+ $c->$cb($patrons->unblessed, 200); >+} >+ >+sub get { >+ my ($c, $args, $cb) = @_; >+ >+ my $user = $c->stash('koha.user'); >+ >+ unless ( $user >+ && ( $user->borrowernumber == $args->{borrowernumber} >+ || haspermission($user->userid, {borrowers => 1}) ) ) >+ { >+ return $c->$cb({error => "You don't have the required permission"}, 403); >+ } >+ >+ my $patron = Koha::Patrons->find($args->{borrowernumber}); >+ unless ($patron) { >+ return $c->$cb({error => "Patron not found"}, 404); >+ } >+ >+ return $c->$cb($patron->unblessed, 200); >+} >+ >+1; >diff --git a/Koha/REST/V1/Patrons.pm b/Koha/REST/V1/Patrons.pm >deleted file mode 100644 >index 426145f..0000000 >--- a/Koha/REST/V1/Patrons.pm >+++ /dev/null >@@ -1,58 +0,0 @@ >-package Koha::REST::V1::Patrons; >- >-# This file is part of Koha. >-# >-# Koha is free software; you can redistribute it and/or modify it under the >-# terms of the GNU General Public License as published by the Free Software >-# Foundation; either version 3 of the License, or (at your option) any later >-# version. >-# >-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY >-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR >-# A PARTICULAR PURPOSE. See the GNU General Public License for more details. >-# >-# You should have received a copy of the GNU General Public License along >-# with Koha; if not, write to the Free Software Foundation, Inc., >-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. >- >-use Modern::Perl; >- >-use Mojo::Base 'Mojolicious::Controller'; >- >-use C4::Auth qw( haspermission ); >-use Koha::Patrons; >- >-sub list_patrons { >- my ($c, $args, $cb) = @_; >- >- my $user = $c->stash('koha.user'); >- unless ($user && haspermission($user->userid, {borrowers => 1})) { >- return $c->$cb({error => "You don't have the required permission"}, 403); >- } >- >- my $patrons = Koha::Patrons->search; >- >- $c->$cb($patrons->unblessed, 200); >-} >- >-sub get_patron { >- my ($c, $args, $cb) = @_; >- >- my $user = $c->stash('koha.user'); >- >- unless ( $user >- && ( $user->borrowernumber == $args->{borrowernumber} >- || haspermission($user->userid, {borrowers => 1}) ) ) >- { >- return $c->$cb({error => "You don't have the required permission"}, 403); >- } >- >- my $patron = Koha::Patrons->find($args->{borrowernumber}); >- unless ($patron) { >- return $c->$cb({error => "Patron not found"}, 404); >- } >- >- return $c->$cb($patron->unblessed, 200); >-} >- >-1; >diff --git a/api/v1/swagger.json b/api/v1/swagger.json >index 8f32781..e821c44 100644 >--- a/api/v1/swagger.json >+++ b/api/v1/swagger.json >@@ -16,7 +16,6 @@ > "paths": { > "/patrons": { > "get": { >- "x-mojo-controller": "Koha::REST::V1::Patrons", > "operationId": "listPatrons", > "tags": ["patrons"], > "produces": [ >@@ -43,7 +42,6 @@ > }, > "/patrons/{borrowernumber}": { > "get": { >- "x-mojo-controller": "Koha::REST::V1::Patrons", > "operationId": "getPatron", > "tags": ["patrons"], > "parameters": [ >-- >2.1.4 >
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 15126
:
44372
|
44373
|
44374
|
44386
|
47785
|
47828
|
47829
|
47843
|
47844
|
48226
|
49781
|
49782
|
49783
|
49845
|
49846
|
49847
|
50142
|
50916
| 50917 |
50918
|
50919