Bugzilla – Attachment 157027 Details for
Bug 33537
Move domain limits from koha-conf to staff SMTP configuration
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 33537: (QA follow-up) Resolve forbidden pattern in REST API
Bug-33537-QA-follow-up-Resolve-forbidden-pattern-i.patch (text/plain), 3.66 KB, created by
Marcel de Rooy
on 2023-10-13 07:31:03 UTC
(
hide
)
Description:
Bug 33537: (QA follow-up) Resolve forbidden pattern in REST API
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2023-10-13 07:31:03 UTC
Size:
3.66 KB
patch
obsolete
>From 94aec7bf57bb3406f91cc70aafba93a6cc33e4a8 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Fri, 25 Aug 2023 08:02:15 +0000 >Subject: [PATCH] Bug 33537: (QA follow-up) Resolve forbidden pattern in REST > API >Content-Type: text/plain; charset=utf-8 > >Resolving: >FAIL Koha/REST/V1/Config/SMTP/DomainLimits.pm > FAIL forbidden patterns > forbidden pattern: Use of $c->validation in API controllers should be avoided (bug 33556) (line 57) > forbidden pattern: Use of $c->validation in API controllers should be avoided (bug 33556) (line 75) > forbidden pattern: Use of $c->validation in API controllers should be avoided (bug 33556) (line 103) > forbidden pattern: Use of $c->validation in API controllers should be avoided (bug 33556) (line 106) > forbidden pattern: Use of $c->validation in API controllers should be avoided (bug 33556) (line 133) > >Test plan: >Run t/db_dependent/api/v1/domain_limits.t > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> >--- > Koha/REST/V1/Config/SMTP/DomainLimits.pm | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > >diff --git a/Koha/REST/V1/Config/SMTP/DomainLimits.pm b/Koha/REST/V1/Config/SMTP/DomainLimits.pm >index 9a4c3b47c1..7d3cce02e0 100644 >--- a/Koha/REST/V1/Config/SMTP/DomainLimits.pm >+++ b/Koha/REST/V1/Config/SMTP/DomainLimits.pm >@@ -53,7 +53,7 @@ Controller method that handles retrieving a single domain limit > sub get { > my $c = shift->openapi->valid_input or return; > return try { >- my $rec = Koha::MailDomainLimits->search_with_group_domain->find( $c->validation->param('domain_limit_id') ); >+ my $rec = Koha::MailDomainLimits->search_with_group_domain->find( $c->param('domain_limit_id') ); > return $c->render( _render_helper( 404, undef, error => "Domain limit not found" ) ) if !$rec; > return $c->render( _render_helper( 200, undef, result => $rec->to_api ) ); > } catch { >@@ -70,7 +70,7 @@ Controller method that handles adding a new domain limit > sub add { > my $c = shift->openapi->valid_input or return; > return try { >- my $limit = Koha::MailDomainLimit->new_from_api( $c->validation->param('body') ); >+ my $limit = Koha::MailDomainLimit->new_from_api( $c->req->json ); > $limit->store->discard_changes; > $c->res->headers->location( $c->req->url->to_string . '/' . $limit->id ); > return $c->render( _render_helper( 201, undef, result => $limit->to_api ) ); >@@ -97,10 +97,10 @@ Controller method that handles updating a domain limit > > sub update { > my $c = shift->openapi->valid_input or return; >- my $limit = Koha::MailDomainLimits->find( $c->validation->param('domain_limit_id') ); >+ my $limit = Koha::MailDomainLimits->find( $c->param('domain_limit_id') ); > return $c->render( _render_helper( 404, undef, error => "Object not found" ) ) if !$limit; > return try { >- $limit->set_from_api( $c->validation->param('body') ); >+ $limit->set_from_api( $c->req->json ); > $limit->store->discard_changes; > return $c->render( _render_helper( 200, undef, result => $limit->to_api ) ); > } catch { >@@ -126,7 +126,7 @@ Controller method that handles deleting a domain limit > > sub delete { > my $c = shift->openapi->valid_input or return; >- my $limit = Koha::MailDomainLimits->find( $c->validation->param('domain_limit_id') ); >+ my $limit = Koha::MailDomainLimits->find( $c->param('domain_limit_id') ); > return $c->render( _render_helper( 404, undef, error => "Domain limit not found" ) ) if !$limit; > return try { > $limit->delete; >-- >2.30.2
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 33537
:
153351
|
153352
|
153353
|
153354
|
153355
|
153356
|
153357
|
153358
|
153359
|
153361
|
153362
|
153363
|
153364
|
154769
|
154770
|
154771
|
154772
|
154773
|
154774
|
154775
|
154776
|
154777
|
154778
|
154779
|
154818
|
154819
|
154820
|
154821
|
154822
|
154823
|
154824
|
154825
|
154826
|
154827
|
154828
|
154829
|
154830
|
154831
|
154832
|
154833
|
154869
|
154870
|
154871
|
154872
|
154873
|
157017
|
157018
|
157019
|
157020
|
157021
|
157022
|
157023
|
157024
|
157025
|
157026
|
157027
|
157028
|
157029
|
157030
|
157031
|
157032
|
157038
|
157039
|
157040
|
157041
|
157042
|
157043
|
157044
|
157045
|
157046
|
157047
|
157048